Timeseries update animation
Hi there, how can we make use of this https://github.com/chartjs/Chart.js/pull/3399 ? It is listening to array modifications like push, shift... Since we are using react state I wonder how we can make this work.
Could you elaborate on the behavior your experiencing versus what you would expect? I'm dealing with some animation issues of my own and am curious if they're related.
No answer in a couple of months closing
Sorry @jerairrest it would be great if it could be reopened.
Basically chart.js supports real time updates for timeseries data. This means that it does a different animation of moving the line/bars on the x axis instead of the new data animation. Chart.js is looking for array modification (push, pull...), unfortunately this is impossible to achieve due to the use of react state.
Interesting. This will require further investigation.
Any update here? I'm also not able to create a live data experience with react due to this.
Same problem here. I'm currently updating data by setting state in componentWillReceiveProps(). Props are passed from the parent component each time it calls API. Unfortunately, this blocks animation to work at all.
When the initial state is loaded to component and no state update is performed animation works fine. What is perhaps interesting I can still update labels dynamically, but when trying to update data - animation breaks.
#Edit: this is actually happening only with Line component, when using Doughnut component I'm updating state the same way and animation is working. I was able to solve issue thanks to the second suggestion by https://github.com/jerairrest/react-chartjs-2/issues/269#issuecomment-387349034 But this is not a very clean solution, so I'm still waiting for some update on this :)
#Edit: react-chartjs-2 @2.7.6
Please try the latest react-chartjs-2 version - if the issue is still relevant, please open a new issue.