Chartjs-Chart JS prepend labels to x-axis with addData

2👍

Instead of using Array.push(), you should use Array.unshift() as follows:

myChart.data.labels.unshift(year);
myChart.data.datasets.forEach((dataset) => {
  dataset.data.unshift(myChart.data.datasets.data);
});

Leave a comment