I'm new to using D3. I'd like to only put ticks on an axis at the start and the end. How do I do this?
Thanks
The minimum and maximum value (the domain extent) are part of the domain path, so one option is to set axis.ticks to zero to hide the ticks and only show the domain path. For example:
However, the domain path doesn't include text labels for the values. So, for that, you could instead set axis.tickValues to the minimum and maximum value for explicit ticks:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With