Adds stop conditions

This commit is contained in:
Roman Galochkin 2020-02-20 13:43:39 +03:00
parent dd1c6435b4
commit 972c9058ef

View File

@ -156,8 +156,12 @@ export class CdfChartD3 {
'translate(' + this.calc.chartLeftMargin + ',' + this.calc.chartTopMargin + ')', 'translate(' + this.calc.chartLeftMargin + ',' + this.calc.chartTopMargin + ')',
); );
if(this.hasDate('primary')){
const distributionChart = this.addDistributionChart(); const distributionChart = this.addDistributionChart();
if(this.hasDate('discrete')) {
this.addLollipopsChart(distributionChart); this.addLollipopsChart(distributionChart);
}
}
return this; return this;
} }
@ -406,8 +410,8 @@ export class CdfChartD3 {
} }
/** /**
* @param key * @param {name} key
* @returns {[]} * @returns {{x: number[], y: number[]}}
*/ */
getDataPoints(key) { getDataPoints(key) {
const dt = []; const dt = [];
@ -421,11 +425,22 @@ export class CdfChartD3 {
return dt; return dt;
} }
/**
* @param {string} key
* @returns {boolean}
*/
hasDate(key) {
const data = _.get(this.attrs.data, key);
return !!data;
}
} }
/** /**
* @docs: https://github.com/d3/d3-selection * @docs: https://github.com/d3/d3-selection
* @param params * @param {object} params
* @param {string} params.selector
* @param {string} params.tag
* @returns {*} * @returns {*}
*/ */
d3.selection.prototype.createObject = function createObject(params) { d3.selection.prototype.createObject = function createObject(params) {
@ -436,7 +451,10 @@ d3.selection.prototype.createObject = function createObject(params) {
/** /**
* @docs: https://github.com/d3/d3-selection * @docs: https://github.com/d3/d3-selection
* @param params * @param {object} params
* @param {string} params.selector
* @param {string} params.tag
* @param {*[]} params.data
* @returns {*} * @returns {*}
*/ */
d3.selection.prototype.createObjectsWithData = function createObjectsWithData(params) { d3.selection.prototype.createObjectsWithData = function createObjectsWithData(params) {