[Chartjs]-How to change X-Axis Interval on Chart.js

17👍

It can be done using the maxTicksLimit option of xAxes, see this working fiddle -> http://jsfiddle.net/Lzo5g01n/3/

xAxes: [{
    type: 'time',
    ticks: {
        autoSkip: true,
        maxTicksLimit: 20
    }
}]

4👍

For Chart.js 3.3.2, you can use @Kunal Khivensara’s approach with a few changes. You can check the documentation. Put ticks in xAxis in scales. Example:

...
options: {
    scales: {
        xAxis: {
            ticks: {
                maxTicksLimit: 10
            }
        }
    }
}
...

Leave a comment