]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Clarify update docs (#11345)
authorJacco van den Berg <jaccoberg2281@gmail.com>
Tue, 13 Jun 2023 16:24:13 +0000 (18:24 +0200)
committerGitHub <noreply@github.com>
Tue, 13 Jun 2023 16:24:13 +0000 (18:24 +0200)
docs/developers/updates.md

index f74730c8e29f39d8680b0ca47f07f949a5a16da0..ed22e3315cb4fe2047c8e4f3e7b0920446224811 100644 (file)
@@ -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();
 }