You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- .update(): add documentation for function argument support
- isDatasetVisible(): add missing method documentation with example
- getDataVisibility(): fix anchor link for toggleDataVisibility
- Static: unregister(): add example
Copy file name to clipboardExpand all lines: docs/developers/api.md
+24-3Lines changed: 24 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -25,13 +25,19 @@ Triggers an update of the chart. This can be safely called after updating the da
25
25
myLineChart.data.datasets[0].data[2] =50; // Would update the first dataset's value of 'March' to be 50
26
26
myLineChart.update(); // Calling update now animates the position of March from 90 to 50.
27
27
```
28
+
A `mode` can be provided to indicate transition configuration should be used. This can be either:
28
29
29
-
A `mode`string can be provided to indicate transition configuration should be used. Core calls this method using any of `'active'`, `'hide'`, `'reset'`, `'resize'`, `'show'` or `undefined`. `'none'` is also a supported mode for skipping animations for single update. Please see [animations](../configuration/animations.md) docs for more details.
30
+
-**string value**: Core calls this method using any of `'active'`, `'hide'`, `'reset'`, `'resize'`, `'show'` or `undefined`. `'none'` is also supported for skipping animations for single update. Please see [animations](../configuration/animations.md) docs for more details.
30
31
31
-
Example:
32
+
-**function**: that receives a context object `{ datasetIndex: number }` and returns a mode string, allowing different modes per dataset.
32
33
34
+
Examples:
33
35
```javascript
36
+
// Using string mode
34
37
myChart.update('active');
38
+
39
+
// Using function mode for dataset-specific animations
Returns a boolean if a dataset at the given index is currently visible.
153
+
154
+
The visibility is determined by first checking the hidden property in the dataset metadata (set via [`setDatasetVisibility()`](#setdatasetvisibility-datasetindex-visibility) and accessible through [`getDatasetMeta()`](#getdatasetmeta-index)). If this is not set, the hidden property of the dataset object itself (`chart.data.datasets[n].hidden`) is returned.
155
+
156
+
```javascript
157
+
chart.isDatasetVisible(1);
158
+
```
144
159
145
160
## setDatasetVisibility(datasetIndex, visibility)
146
161
@@ -162,7 +177,7 @@ chart.update(); // chart now renders with item hidden
162
177
163
178
## getDataVisibility(index)
164
179
165
-
Returns the stored visibility state of a data index for all datasets. Set by [toggleDataVisibility](#toggleDataVisibility). A dataset controller should use this method to determine if an item should not be visible.
180
+
Returns the stored visibility state of a data index for all datasets. Set by [toggleDataVisibility](#toggledatavisibility-index). A dataset controller should use this method to determine if an item should not be visible.
0 commit comments