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 type definitions and docs for legends
* Fix types for onHover and onClick callbacks
core.controller.js's implementation also passes the Chart instance as `this`. However, that isn't documented, and it's my impression that Chart.js is moving away from passing items as `this`, so I didn't declare it in the type definitions.
* Allow multi-line ticks
* Stricter DeepPartial definition
The previous definition resolved to `{}` (which can allow primitives) if it was given a function, so it was far too broad for any `Scriptable<>` properties.
* Grammar and writing style
* Updates to animation docs
Document the `fn` option, since it's in the type definitions.
Fix callback usage to match example code.
* Fix AnimationEvent parameter
The onProgress and onComplete events were mistakenly declared as taking the standard DOM AnimationEvent. (Should Chart.js's AnimationEvent be renamed to ChartAnimationEvent to avoid any possible ambiguity?)
* Allow false for disabling animations
* Add comments explaining the layout and usage of Rollup
Copy file name to clipboardExpand all lines: docs/docs/configuration/animations.mdx
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ The default configuration is defined here: <a href="https://github.com/chartjs/C
123
123
| [[property]](#animation-property-configuration) | `object` | `undefined` | Option overrides for a single element `[property]`. These have precedence over `[collection]`. See **Looping tension [property]** example above.
124
124
| [[collection]](#animation-properties-collection-configuration) | `object` | [defaults...](#default-collections) | Option overrides for multiple properties, identified by `properties` array.
125
125
126
-
These defaults can be overridden in `options.animation` or `dataset.animation` and `tooltip.animation`. These keys are also [Scriptable](../general/options.md#scriptable-options)
126
+
These defaults can be overridden in `options.animation` or `dataset.animation` and `tooltip.animation`. These keys are also [Scriptable](../general/options.md#scriptable-options).
127
127
128
128
## Animation mode configuration
129
129
@@ -153,6 +153,7 @@ A property option is defined by the same options of the main [animation configur
153
153
| `type` | `string` | `typeof property` | Type of property, determines the interpolator used. Possible values: `'number'`, `'color'` and `'boolean'`. Only really needed for `'color'`, because `typeof` does not get that right.
154
154
| `from` | <code>`number`|`Color`|`boolean`</code> | `undefined` | Start value for the animation. Current value is used when `undefined`
155
155
| `to` | <code>`number`|`Color`|`boolean`</code> | `undefined` | End value for the animation. Updated value is used when `undefined`
156
+
|`fn`| <code><T>(from: T, to: T, factor: number) => T;</code> |`undefined`| Optional custom interpolator, instead of using a predefined interpolator from `type`|
156
157
157
158
## Animation properties collection configuration
158
159
@@ -183,7 +184,7 @@ These default collections are overridden by most dataset controllers.
183
184
184
185
## Disabling animation
185
186
186
-
To disable an animation configuration, the animation node must be set to `false`, with the exception for animation modes which can be disable setting the `duration` to `0`.
187
+
To disable an animation configuration, the animation node must be set to `false`, with the exception for animation modes which can be disabled by setting the `duration` to `0`.
187
188
188
189
```javascript
189
190
chart.options.animation=false; // disables the whole animation
@@ -232,15 +233,15 @@ See [Robert Penner's easing equations](http://robertpenner.com/easing/).
232
233
233
234
## Animation Callbacks
234
235
235
-
The animation configuration enables the callbacks which are useful for synchronizing an external draw to the chart animation.
236
+
The animation configuration provides callbacks which are useful for synchronizing an external draw to the chart animation.
236
237
The callbacks can be set only at main [animation configuration](#animation-configuration).
237
238
238
239
| Name | Type | Default | Description
239
240
| ---- | ---- | ------- | -----------
240
241
| `onProgress` | `function` | `null` | Callback called on each step of an animation.
241
242
| `onComplete` | `function` | `null` | Callback called when all animations are completed.
0 commit comments