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
Check this if you would like to implement a PR, we are more than happy to help you go through the process.
What problem are you trying to solve?
I have a line chart where I want to be able to add data after its initially drawn. When I do that, it replays the initial animation where each point goes from 0 to its intended position but I'd like to avoid that.
It would be great if it was possible to specify the mode to update the chart with, or provide some other mechanism to say that you dont want to animate for a particular update.
Alternatively if anyone knows of a way I can achieve this with the current implementation that would be super helpful.
Describe alternatives you've considered
I tried setting animation duration to 0 when sending the updated data and then setting it back afterwards but that didn't seem to work as it still animated and felt pretty hacky. Maybe i could set the animation duration in one render and then update the data, then set the anaimation duration back to its original value? I haven't tried that but it feels even more hacky.
Documentation, Adoption, Migration Strategy
No response
The text was updated successfully, but these errors were encountered:
@M4sterShake Hi. It's a good point. But did you try to set redraw={true} prop as a temporary solution?
Thanks @dangreen I've just tried that but with redraw={true} it still performs the initial animation again. Don't suppose you have any other ideas? Your helps really appreciated :)
edit - i've just thought do you mean to use redraw={true} in conjunction with setting animation duration to 0 and back?
edit2 - I've tried setting redraw to true then adding the additional data and setting the animation duration to 0, then setting redraw to false and animation duration back to its original value but it doesnt seem to help. Thanks for the suggestion though!
Would you like to work on this feature?
What problem are you trying to solve?
I have a line chart where I want to be able to add data after its initially drawn. When I do that, it replays the initial animation where each point goes from 0 to its intended position but I'd like to avoid that.
In the chart.js docs it says that you can prevent animations by calling update with none as the mode here: https://www.chartjs.org/docs/latest/developers/updates.html#preventing-animations
But in the react-chartjs-2 code it looks like updates are always done without a value passed for mode
react-chartjs-2/src/chart.tsx
Line 85 in 4a01054
Describe the solution you'd like
It would be great if it was possible to specify the mode to update the chart with, or provide some other mechanism to say that you dont want to animate for a particular update.
Alternatively if anyone knows of a way I can achieve this with the current implementation that would be super helpful.
Describe alternatives you've considered
I tried setting animation duration to 0 when sending the updated data and then setting it back afterwards but that didn't seem to work as it still animated and felt pretty hacky. Maybe i could set the animation duration in one render and then update the data, then set the anaimation duration back to its original value? I haven't tried that but it feels even more hacky.
Documentation, Adoption, Migration Strategy
No response
The text was updated successfully, but these errors were encountered: