Chartjs-What is the correct format for time data in chartjs?

0👍

The date values must be entered as a javascript Date object. Just like the documentation says,

data: [{
    x: new Date(),
    y: 1
}, {
    t: new Date(),
    y: 10
}]

So in my question, the dates could be represented by:

data: [
{x:new date(15-04-2018),y:10},
{x:new date(16-04-2018),y:20},
{x:new date(17-04-2018),y:30}
]

Leave a comment