[Chartjs]-How to reduce the number of points shown on line chartjs chart with a large dataset?

2👍

You need to make a custom modification to the ChartJS library. ChartJS by default has no options to skip X labels. Checkout this library https://github.com/hay-wire/Chart.js/tree/skip-xlabels which has a modification to allow you to show a certain number of X labels per tick by calling {showXLabels: 10}.

lineChart = new Chart(ctxlc).Line(datalc, {
    showXLabels: 10
});

If that is too complicated / you need to keep your current chart JS library it is easy enough to pass empty quotes as each label so that all the points show but only some labels do.

Maybe I got off track here, but if you really only want to show 10 points and not 100, why not just pass only those 10 points to the chartJS library? I’m assuming you only want to show a limited number of labels?

Leave a comment