Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ticks only at the start and end of an axis [closed]

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

like image 593
Clive Avatar asked Jun 26 '12 15:06

Clive


1 Answers

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:

  • http://bl.ocks.org/2996766

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:

  • http://bl.ocks.org/2996785
like image 105
mbostock Avatar answered Sep 22 '22 13:09

mbostock