Skip to content Skip to sidebar Skip to footer

How To Skip Labels On X-axes?

I've been trying for a long time now to figure out how to skip labels on the x-axes of this chart. So, for instance, display every third or fourth label. I've tried adding autoSki

Solution 1:

In the chart options, you can change an axe's ticks' callback to display the tick (the label) based on a value, or even change what it displays :

options: {
    scales: {
        xAxes: [{
            ticks: {
                callback: function(tick, index, array) {
                    return (index % 3) ? "" : tick;
                }
            }
        }]
    }
}

This option basically display one tick every three.


You can check a full script in this jsfiddle, and here is its result :

enter image description here

Post a Comment for "How To Skip Labels On X-axes?"