I added zoom functionality to a d3 line chart and it was working fine at first. However, after zooming to a certain level, the y-axis ticks started displaying decimal numbers like (3.400000001). I then included the following code:
.tickFormat(d3.format(",.0f"))
This resolved the issue and the numbers displayed as whole numbers. But now, a new problem arises where the same number repeats on the y-axis at certain zoom levels. How can I address this problem?
Alternatively, is there a way to limit the y-axis ticks to two decimal places?
Here is my code for the Y-axis:
var yAxis = d3.svg.axis().scale(y).tickFormat(d3.format(",.0f")).ticks(10).orient("left");