-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Labels
Description
Documentation Is:
- Missing or needed?
- Confusing
- Not sure?
Please Explain in Detail...
At this URL (/docs/latest/developers/updates.html) we have confusing instructions: data is everywhere.
My request is: update content at Adding or Removing Data section.
My suggestion is below.
When you want to change the graphic displayed (adding points), you need to provide newData in order to update the data array within each graphic. If you want to remove points from graphic, you just pop them from graphic. See samples below.
function addData(chart, label, **newData**) {
chart.data.labels.push(label);
chart.data.datasets.forEach((dataset) => {
dataset.data.push(**newData**);
});
chart.update();
}
function removeData(chart) {
chart.data.labels.pop();
chart.data.datasets.forEach((dataset) => {
dataset.data.pop();
});
chart.update();
}
Your Proposal for Changes
Update content at Adding or Removing Data documentation section, in order to be more clear and precise. The way data is shown is confusing, since there are two different places with the same var name.