← All Articles A Product of Kinsa Creative

Hide the 0 value on the Y axis in chart.js 4

When defining the Chart (see a fuller code example in this post), set options.scales.y.ticks as follows:

ticks: {
    callback: function ( value, index, values ) {
        // hide the first value (0)
        if ( index !== 0 ) {
            return value;
        } else {
            return undefined;
        }
    },
}

Feedback?

Email us at enquiries@kinsa.cc.