Adds todo
This commit is contained in:
parent
26ae5f5595
commit
8d875cc00d
|
@ -124,9 +124,14 @@ export class CdfChartD3 {
|
||||||
*/
|
*/
|
||||||
getCommonThings() {
|
getCommonThings() {
|
||||||
// Boundaries.
|
// Boundaries.
|
||||||
const xMin = this.attrs.minX
|
// @todo: To fix code construction.
|
||||||
|
const xMin = this.attrs.scale === 'linear' ?
|
||||||
|
(this.attrs.minX
|
||||||
|| d3.min(this.attrs.data.continuous.xs)
|
|| d3.min(this.attrs.data.continuous.xs)
|
||||||
|| d3.min(this.attrs.data.discrete.xs);
|
|| d3.min(this.attrs.data.discrete.xs))
|
||||||
|
: ((this.attrs.minX > 0 ? this.attrs.minX : undefined)
|
||||||
|
|| d3.min(this.attrs.data.continuous.xs.filter(i => i > 0))
|
||||||
|
|| d3.min(this.attrs.data.discrete.xs.filter(i => i > 0)));
|
||||||
const xMax = this.attrs.maxX
|
const xMax = this.attrs.maxX
|
||||||
|| d3.max(this.attrs.data.continuous.xs)
|
|| d3.max(this.attrs.data.continuous.xs)
|
||||||
|| d3.max(this.attrs.data.discrete.xs);
|
|| d3.max(this.attrs.data.discrete.xs);
|
||||||
|
@ -142,7 +147,7 @@ export class CdfChartD3 {
|
||||||
const yMaxDomain = yMax * yMaxDomainFactor;
|
const yMaxDomain = yMax * yMaxDomainFactor;
|
||||||
|
|
||||||
// X-scale.
|
// X-scale.
|
||||||
let xScale = this.attrs.scale === 'linear'
|
const xScale = this.attrs.scale === 'linear'
|
||||||
? d3.scaleLinear()
|
? d3.scaleLinear()
|
||||||
.domain([xMinDomain, xMaxDomain])
|
.domain([xMinDomain, xMaxDomain])
|
||||||
.range([0, this.calc.chartWidth])
|
.range([0, this.calc.chartWidth])
|
||||||
|
@ -211,14 +216,6 @@ export class CdfChartD3 {
|
||||||
const yAxis = d3.axisRight(yScale);
|
const yAxis = d3.axisRight(yScale);
|
||||||
|
|
||||||
// Objects.
|
// Objects.
|
||||||
const line = d3.line()
|
|
||||||
.x(d => xScale(d.x))
|
|
||||||
.y(d => yScale(d.y));
|
|
||||||
|
|
||||||
const area = d3.area()
|
|
||||||
.x(d => xScale(d.x))
|
|
||||||
.y1(d => yScale(d.y))
|
|
||||||
.y0(this.calc.chartHeight);
|
|
||||||
|
|
||||||
// Add axis.
|
// Add axis.
|
||||||
this.chart
|
this.chart
|
||||||
|
@ -233,6 +230,11 @@ export class CdfChartD3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw area.
|
// Draw area.
|
||||||
|
const area = d3.area()
|
||||||
|
.x(d => xScale(d.x))
|
||||||
|
.y1(d => yScale(d.y))
|
||||||
|
.y0(this.calc.chartHeight);
|
||||||
|
|
||||||
this.chart
|
this.chart
|
||||||
.createObjectsWithData({
|
.createObjectsWithData({
|
||||||
tag: 'path',
|
tag: 'path',
|
||||||
|
@ -245,6 +247,10 @@ export class CdfChartD3 {
|
||||||
|
|
||||||
// Draw line.
|
// Draw line.
|
||||||
if (this.attrs.showDistributionLines) {
|
if (this.attrs.showDistributionLines) {
|
||||||
|
const line = d3.line()
|
||||||
|
.x(d => xScale(d.x))
|
||||||
|
.y(d => yScale(d.y));
|
||||||
|
|
||||||
this.chart
|
this.chart
|
||||||
.createObjectsWithData({
|
.createObjectsWithData({
|
||||||
tag: 'path',
|
tag: 'path',
|
||||||
|
@ -467,8 +473,10 @@ export class CdfChartD3 {
|
||||||
const x = data.xs[i];
|
const x = data.xs[i];
|
||||||
const y = data.ys[i];
|
const y = data.ys[i];
|
||||||
const id = i;
|
const id = i;
|
||||||
|
if (x > 0) {
|
||||||
dt.push({ x, y, id });
|
dt.push({ x, y, id });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user