Fixes variables scopes (3)

This commit is contained in:
Roman Galochkin 2020-02-20 13:33:43 +03:00
parent e2d5426616
commit 773e77534d

View File

@ -342,14 +342,14 @@ export class CdfChartD3 {
.call(d3.axisBottom(distributionChart.xScale)); .call(d3.axisBottom(distributionChart.xScale));
// Y axis // Y axis
const y = d3.scaleLinear() const yScale = d3.scaleLinear()
.domain([yMin, yMax]) .domain([yMin, yMax])
.range([this.calc.chartHeight, 0]); .range([this.calc.chartHeight, 0]);
this.chart.append("g") this.chart.append("g")
.attr("class", 'lollipops-y-axis') .attr("class", 'lollipops-y-axis')
.attr("transform", "translate(" + this.calc.chartWidth + ",0)") .attr("transform", "translate(" + this.calc.chartWidth + ",0)")
.call(d3.axisLeft(y)); .call(d3.axisLeft(yScale));
// Lines // Lines
this.chart.selectAll("lollipops-line") this.chart.selectAll("lollipops-line")
@ -359,8 +359,8 @@ export class CdfChartD3 {
.attr("class", 'lollipops-line') .attr("class", 'lollipops-line')
.attr("x1", d => distributionChart.xScale(d.x)) .attr("x1", d => distributionChart.xScale(d.x))
.attr("x2", d => distributionChart.xScale(d.x)) .attr("x2", d => distributionChart.xScale(d.x))
.attr("y1", d => y(d.y)) .attr("y1", d => yScale(d.y))
.attr("y2", y(0)); .attr("y2", yScale(0));
// Circles // Circles
this.chart.selectAll("lollipops-circle") this.chart.selectAll("lollipops-circle")
@ -369,7 +369,7 @@ export class CdfChartD3 {
.append("circle") .append("circle")
.attr("class", 'lollipops-circle') .attr("class", 'lollipops-circle')
.attr("cx", d => distributionChart.xScale(d.x)) .attr("cx", d => distributionChart.xScale(d.x))
.attr("cy", d => y(d.y)) .attr("cy", d => yScale(d.y))
.attr("r", "4"); .attr("r", "4");
} }