Chartjs-Chart.js wrong x axis date time?

0👍

Modify the dataset like this:

datasets: [{
    label: 'Impressions',
      data: [
            {
             x: new Date('2018-03-28'),
             y: 0
            }, {
             x: new Date('2018-03-29'),
             y: 0
            },
            {
             x: new Date('2018-03-30'),
             y: 0
            }
        ...

And the ‘options’ should be:

options: {
   scales: {
      xAxes: [{
          type: 'time'
      }]
    }
}

Leave a comment