[Chartjs]-Dynamically created Chart.js chart overpopulating time based x-axis?

1👍

The problem is due to the option ticks.source: 'labels' defined on your x-axis. You should change it to ticks.source: 'data' or simply omit it and let Chart.js choose the best option.

Also when providing the data as data points using t and y properties, there’s no need to define chart.data.labels.

success: function(json){
  var dates = json['dates'].map(v => new Date(v).toLocaleString())
  chart.data.labels.push(dates); // remove this line
  ...

Leave a comment