Accepted answer

You can can pass an array of ticks to an axis, and the axis will then plot ticks at the points in an array.

Here is some sample code. An axis is created that runs between 0 and 100. Tick marks are plotted at 0, 50, 60 and 100, in accordance with the 'ticks' array.

svg ="svg")

var myScale = d3.scale.linear()

var ticks = [0,50,60,100];

var myAxis = d3.svg.axis()

.attr("class", "axis")

Here is an interactive example:

Related Query

More Query from same tag