0👍
✅
You can create a function that will accept data. Just pass the data that you get from POST request and chart.update()
will do the magic. Make sure to pass the chart reference in chart
variable.
function addData(chart, label, data) {
chart.data.labels.push(label);
chart.data.datasets.forEach((dataset) => {
dataset.data.push(data);
});
chart.update();
}
Source:stackexchange.com