Chartjs-HTML: How to get rid of overlapping

0πŸ‘

βœ…

To update the limit dynamically, change the maxTicksLimit value, then call update on the chart. To keep access to the generated chart, I used a closure, but a global variable would work as well.

Note that the xAxes is an array.

(function(theChart){
  $("#demo").click(function() {
    theChart.options.scales.xAxes[0].ticks.maxTicksLimit = 5;
    theChart.update();
  });
}(chart));

updated fiddle

The example is changing on a click, but the same would work on any other trigger.

0πŸ‘

It may not make complete sense with the data in your sample, but for the specific question:

    ticks: {
      maxTicksLimit: 10,
      autoSkip: true
    }

https://jsfiddle.net/microMerlin/x2o58gbe/1/

See http://www.chartjs.org/docs/latest/axes/cartesian/linear.html and http://www.chartjs.org/docs/latest/axes/cartesian/#tick-configuration

Leave a comment