Ok, works
This commit is contained in:
parent
2965d627f5
commit
dc8831def0
|
@ -144,16 +144,13 @@ export class CdfChartD3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculated properties.
|
// Calculated properties.
|
||||||
// id for event handlings.
|
|
||||||
const calc = {};
|
const calc = {};
|
||||||
calc.id = 'ID' + Math.floor(Math.random() * 1000000);
|
|
||||||
calc.chartLeftMargin = attrs.marginLeft;
|
calc.chartLeftMargin = attrs.marginLeft;
|
||||||
calc.chartTopMargin = attrs.marginTop;
|
calc.chartTopMargin = attrs.marginTop;
|
||||||
calc.chartWidth = attrs.svgWidth - attrs.marginRight - attrs.marginLeft;
|
calc.chartWidth = attrs.svgWidth - attrs.marginRight - attrs.marginLeft;
|
||||||
calc.chartHeight = attrs.svgHeight - attrs.marginBottom - attrs.marginTop;
|
calc.chartHeight = attrs.svgHeight - attrs.marginBottom - attrs.marginTop;
|
||||||
|
|
||||||
const areaColor = d3.scaleOrdinal().range(attrs.areaColors);
|
const areaColorRange = d3.scaleOrdinal().range(attrs.areaColors);
|
||||||
|
|
||||||
this.dataPoints = [this.getDatapoints('primary')];
|
this.dataPoints = [this.getDatapoints('primary')];
|
||||||
|
|
||||||
// Scales.
|
// Scales.
|
||||||
|
@ -209,7 +206,7 @@ export class CdfChartD3 {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Line generator.
|
// Objects.
|
||||||
const line = d3.line()
|
const line = d3.line()
|
||||||
.x(d => this.xScale(d.x))
|
.x(d => this.xScale(d.x))
|
||||||
.y(d => this.yScale(d.y));
|
.y(d => this.yScale(d.y));
|
||||||
|
@ -247,7 +244,7 @@ export class CdfChartD3 {
|
||||||
data: this.dataPoints,
|
data: this.dataPoints,
|
||||||
})
|
})
|
||||||
.attr('d', area)
|
.attr('d', area)
|
||||||
.attr('fill', (d, i) => areaColor(i))
|
.attr('fill', (d, i) => areaColorRange(i))
|
||||||
.attr('opacity', (d, i) => i === 0 ? 0.7 : 0.5);
|
.attr('opacity', (d, i) => i === 0 ? 0.7 : 0.5);
|
||||||
|
|
||||||
// Draw line.
|
// Draw line.
|
||||||
|
@ -368,6 +365,11 @@ export class CdfChartD3 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo: To rework it somehow.
|
||||||
|
* @param params
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
d3.selection.prototype.patternify = function patternify(params) {
|
d3.selection.prototype.patternify = function patternify(params) {
|
||||||
const selector = params.selector;
|
const selector = params.selector;
|
||||||
const elementTag = params.tag;
|
const elementTag = params.tag;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user