0👍
You can read this doc https://www.chartjs.org/docs/latest/developers/updates.html
update data via this function
function addData(chart, label, data) {
chart.data.labels.push(label);
chart.data.datasets.forEach((dataset) => {
dataset.data.push(data);
});
chart.update();
}
function removeData(chart) {
chart.data.labels.pop();
chart.data.datasets.forEach((dataset) => {
dataset.data.pop();
});
chart.update();
}
- Chartjs-Chart v4 : Module not found: Error: Package path . is not exported from package node_modules/chart.js
- Chartjs-How to shift the origin along y-axis direction in a chart.js3 line chart, so that x-axis pass through a different point other than (0,0)?
Source:stackexchange.com