Chartjs-ChartJS Line Chart – Points Connected out of order for Timeseries in Angular 6

1👍

You need to format your time values using the new Date().
ChartJS assumes it is a Date.

Try if the below works :

 public chartData = [
{data: [
  {x: Date.parse(1539156000000), y: 0},
  {x: Date.parse(1539156480000), y: 0},
  {x: Date.parse(1539156300000), y: 0},
  {x: Date.parse(1539156600000), y: 3051},
  {x: Date.parse(1539155640000), y: 0}
], 
  label: 'A1', fill: false, borderColor: 'red'}
]

Leave a comment