0👍
What you see in the updated chart is only the first values of your new data.
casesChart.data.datasets[0].data = data
It seems that the data and the labels are out of sync. You probably also need to update the labels
. Their number should be identical to the number of values contained in data
.
casesChart.data.labels = <new labels>
- Chartjs-Chartjs angular update order
- Chartjs-Drawing a line at a fixed angle relative to data with Chart.js
0👍
The issue in my particular case was that the array was being outputted as a string rather than a JavaScript object.
I was able to fix it with the JS Split String command using the comma as the delimiter which then after testing in console.log confirmed it was again an Array object.
Source:stackexchange.com