1👍
You can just use the function in the documentation page, you have to pass the chart, label and data.
function addData(chart, label, data) {
chart.data.labels.push(label);
chart.data.datasets.forEach((dataset) => {
dataset.data.push(data);
});
chart.update();
}
if you need to remove previous data
function removeData(chart) {
chart.data.labels.pop();
chart.data.datasets.forEach((dataset) => {
dataset.data.pop();
});
chart.update();
}
- Chartjs-Modifying values in a radar chart.js based on user input
- Chartjs-Canvas Emptied but Reappears
Source:stackexchange.com