Skip to content

Commit

Permalink
Clarify update docs (#11345)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeLenaleee committed Jun 13, 2023
1 parent ec7be48 commit 992d932
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/developers/updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ It's pretty common to want to update charts after they've been created. When the

## Adding or Removing Data

Adding and removing data is supported by changing the data array. To add data, just add data into the data array as seen in this example.
Adding and removing data is supported by changing the data array. To add data, just add data into the data array as seen in this example, to remove it you can pop it again.

```javascript
function addData(chart, label, data) {
function addData(chart, label, newData) {
chart.data.labels.push(label);
chart.data.datasets.forEach((dataset) => {
dataset.data.push(data);
dataset.data.push(newData);
});
chart.update();
}
Expand Down

0 comments on commit 992d932

Please sign in to comment.