Chartjs 3.6.0 add X label

1👍

Chart.js v3 has lots of API changes from Chart.js v2, you should pass your title configuration like this:

const titleConfig = {
    scales: {
        x: {
            display: true,
            title: {
                display: true,
                text: "Time",
                padding: { top: 20, left: 0, right: 0, bottom: 0 },
            },
        },
        y: {
            display: true,
            title: {
                display: true,
                text: "Value",
                padding: { top: 30, left: 0, right: 0, bottom: 0 },
            },
        },
    },
};

More information on how to use title configuration can be found on the documentation.
Here’s a working fiddle: https://jsfiddle.net/vkghzxLc/15/

👍:0

Basicly your whole options object is wrong, there are some major breaking changes in chart.js v3. For all changes please read the migration guide.

For the scale label to show you need to configure it in options.scales.x.title.text, also the tooltip and legend need to be configured in the plugins namespace, tooltip has been made singular

Leave a comment