Limit labels number on Chart.js line chart

mmmm picture mmmm · Feb 27, 2014 · Viewed 94.9k times · Source

I want to display all of the points on my chart from the data I get, but I don't want to display all the labels for them, because then the chart is not very readable. I was looking for it in the docs, but couldn't find any parameter that would limit this.

I don't want to take only three labels for example, because then the chart is also limited to three points. Is it possible?

I have something like that right now:

enter image description here

If I could just leave every third-fourth label, it would be great. But I found absolutely nothing about labels options.

Answer

Nikita Ag picture Nikita Ag · Sep 5, 2016

Try adding the options.scales.xAxes.ticks.maxTicksLimit option:

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