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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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: