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);
});
Source:stackexchange.com