Adds ticks

This commit is contained in:
Roman Galochkin 2020-02-28 13:49:39 +03:00
parent db1b1b2a7b
commit 9592e50c1b

View File

@ -337,11 +337,14 @@ export class CdfChartD3 {
.domain([yMinDomain, yMaxDomain]) .domain([yMinDomain, yMaxDomain])
.range([this.calc.chartHeight, 0]); .range([this.calc.chartHeight, 0]);
const yTicks = Math.floor(this.calc.chartHeight / 20);
const yAxis = d3.axisLeft(yScale).ticks(yTicks);
// Adds 'g' for an y-axis. // Adds 'g' for an y-axis.
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(yScale)); .call(yAxis);
function showTooltip(d) { function showTooltip(d) {
d3.select('#lollipops-line-' + d.id) d3.select('#lollipops-line-' + d.id)