javascriptdimple.js

How to set the interval of ticks on the X-Axis using dimple.js


I am using the following code to plot some data related to the passengers of the titanic by age using dimple.js:

var myChart = new dimple.chart(svg, data);
var ageAxis = myChart.addCategoryAxis("x", "Age"); 
myChart.addMeasureAxis("y", "Survived");
myChart.addSeries(null, dimple.plot.line);
ageAxis.addOrderRule('Age',false);
ageAxis.ticks=5; // this doesn't seem to work unfortunately
myChart.draw();

I get the following chart:

enter image description here

I want to define an interval for the ticks in the x axis to only display some of them

Thanks in advance


Solution

  • You can remove the excess labels after drawing as explained in the answer here:

    cleaning axis in dynamic charts in dimple.js