How do we change the tick values generated by a linear scale in a d3.js line plot?

后端 未结 2 1917
逝去的感伤
逝去的感伤 2021-01-01 23:50

I only had 5 values[1,2,3,4,5] as my y - coordinates in the d3.js line plot. But, I end up getting more values [0.5,1,1.5,2,2.5,3,3.5,4,4.5,5] Is there a way to edit the d3.

2条回答
  •  独厮守ぢ
    2021-01-02 00:11

    Yes you can also try

    yAxis.ticks(5).tickFormat(D3.numberFormat(",d"));

    It does the trick of eliminating the decimal numbers, does not effect number of ticks

    Here is a good resource for the format of the numbers using D3.

提交回复
热议问题