Adding or changing data dyamically in chart.js 2.0 is easy
First, let me add a button to test our adding function
To add data, access the data array of the chart directly from the chart object
We need to add both data value and a new label
We need to get the next available array index of the data array
Currently we have 7 data points so the next available index is 7 (index start at 0)
Set it to the Y-Axis value that you'd like
Next, add a label the same way we just did
Finally, call the update() method to update the chart
To change the existing data point. We can do it the same way as adding
Just change the array index to the data point that you'd like to update
Thanks for watching. Please like or subscribe to support us :
