Ticks only at the beginning and end of the axis

I am new to using D3. I would only like to put ticks on the axis at the beginning and at the end. How to do it?

thanks

+6
source share
1 answer

The minimum and maximum values ​​(domain length) are part of the path to the domain, so one of the options is to set axis.ticks to zero to hide the ticks and only show the path to the domain. For instance:

However, the domain path does not contain text labels for the values. So instead you can set axis.tickValues ​​the minimum and maximum value for explicit ticks:

+12
source

Source: https://habr.com/ru/post/919050/


All Articles