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):
- Chartjs-Where does chartjs document what is required in the myChartConfig to instantiate using myChart = new Chart(ctx, myChartConfig)
- Chartjs-How to sum value by month and assign two different variables?
Source:stackexchange.com