d3 / d3-scale

Encodings that map abstract data to visual representation.

Home Page:https://d3js.org/d3-scale

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How can I set d3 linearScale tick start and each stop length

georgezouq opened this issue · comments

I want to change linearScale tick start and stop length. Say one linearScale domain (0-100) but tick is start in 20 and each tick stop 10. When use scale.ticks() generate tick list like: [20, 30, 40, 50, 60, 70, 80, 90, 100]. How can I do that?

short answer you can't do that on the scale itself https://github.com/d3/d3-scale#continuous_ticks

but if you're using these ticks to display an axis, then you can specify the ticks on the axis with axis.tickValues([20, 30…])
https://github.com/d3/d3-axis#axis_tickValues