You could set the number of ticks via ticks
or the values to display via tickValues
explicitly:
var yAxis = new Rickshaw.Graph.Axis.Y( {
graph: graph,
tickFormat: Rickshaw.Fixtures.Number.formatKMBT,
//ticks: 5, //static number of ticks, only works
tickValues: [50,100,150,200,250,300,350], // values to use/display
element: document.getElementById('y_axis')
} );
You would use either ticks
or tickValues
, not both. If you use tickValues
as above and your max y value is 180
, the y-scale would only show the values [50,100,150,200]
, 250
and above would not be shown. If you add more data with a higher y-value, the scale would automatically re-scale and show the higher values as specified by you.
More information about ticks
and tickValues
can be found at the D3's SVG axes page.