[Chartjs]-Changing x axis labels in Chart.js line chart

7👍

With Chart.js you can’t override the horizontal axis labels. Its a great library, sad it doesn’t support this.

The easiest way to do it, without getting into the Chart.js code and without redrawing the canvas, is to leave the label cell with an empty string.

For example, if you just want to show the x axis label every 10 points, you can do something like this when generating the labels:

    if (ix % 10 == 0) {
        labels[ix]="Label";
    } else {
        labels[ix]="";
    }

Leave a comment