Chartjs-Chart does not change the values when the variable changes the value

1👍

It seems that onchange doesn’t trigger (internal Jsfiddle problem). If you copy your code to your HTML it works without errors, but not updates graph.

You need to change data before calling update():

document.getElementById("demo").innerHTML = adata;
myChart.data.datasets[0].data = adata;
myChart.update();

I changed your jsfiddle to listen another change event, but you don’t need to if you doing this locally (not jsfiddle):

https://jsfiddle.net/ndq6msuz/3/

Leave a comment