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
My goal is to allow the same performance optimization that are applied when animations are disabled (i.e. with options.animation = false) or when using mode="none" (i.e. chart.update('none')) to animations with a duration of 0 (i.e. options.animation.duration = 0).
Example context
Sometimes its desirable to only enable animations for certain situations. For example, you may want to generally disable most animations upon updates, but keep around animations for things like zooming (where the animation is more important to preserve context). As suggested in the docs, you can accomplish this with a setup like this:
Note that you cannot set options.animations = false or else all animations are disabled (including zoom).
In this situation, any chart update with a mode other than 'zoom' can equivalently run with mode='none' since the animations are disabled via duration=0. However, currently chartjs will still use the animation-based render, preventing certain performance optimizations in updaters (such as dataset direct update and line controller direct update). These performance optimizations can significantly speed up renders for large datasets (ex. 200ms -> 30ms).
Possible Implementation
One options could be to detect in chart.update() if an update mode effectively has its animations disabled (via duration=0). In this event, mode could automatically be remapped to 'none' so downstream updates don't need to change their logic (ex. dataset and line controller both already support optimizing mode='none').
The text was updated successfully, but these errors were encountered:
@LeeLenaleee I saw you were contributing more actively to chartjs lately if you have any thoughts here. I'd be happy to help contribute for this improvement, but would like some guidance / validation
Feature Proposal
My goal is to allow the same performance optimization that are applied when animations are disabled (i.e. with
options.animation = false
) or when using mode="none" (i.e.chart.update('none')
) to animations with a duration of 0 (i.e.options.animation.duration = 0
).Example context
Sometimes its desirable to only enable animations for certain situations. For example, you may want to generally disable most animations upon updates, but keep around animations for things like zooming (where the animation is more important to preserve context). As suggested in the docs, you can accomplish this with a setup like this:
Note that you cannot set
options.animations = false
or else all animations are disabled (including zoom).In this situation, any chart update with a mode other than 'zoom' can equivalently run with
mode='none'
since the animations are disabled via duration=0. However, currently chartjs will still use the animation-based render, preventing certain performance optimizations in updaters (such as dataset direct update and line controller direct update). These performance optimizations can significantly speed up renders for large datasets (ex. 200ms -> 30ms).Possible Implementation
One options could be to detect in
chart.update()
if an update mode effectively has its animations disabled (viaduration=0
). In this event, mode could automatically be remapped to 'none' so downstream updates don't need to change their logic (ex. dataset and line controller both already support optimizingmode='none'
).The text was updated successfully, but these errors were encountered: