score:0

Accepted answer

first of all, since the documentation is messy, i'm not surprised you didn't get how to create a time-scale chart. the actual call is the following :

window.myscatterxx = chart.scatter(ctx, {
    data: chartdata,
    options: {
        title: {
            display: true,
            text: "it is now working",
            fontsize: 36
        },
        scales: {
            xaxes: [{
                // this is the important part
                type: "time",
            }]
        }
    },
});


now you have the correct syntax, you'd need to import the correct library as well. as i can see in the piece of code you gave, you imported chart.min.js, but you need more since you know work with the time element.

you can either :


finally, i also noticed in your code you had a problem displaying tooltips for the red dataset. it is because you defined its color as red. change it to red and tooltips will work again :

datasets: [{
    bordercolor: 'red',
    label: 'capital r in bordercolor, tooltips now work',
    data: [
        // ...
    ]
}]

you can see all these fixes live in this jsfiddle, and here is the final result :

enter image description here


Related Query

More Query from same tag