Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[charts] Fix line animation #12892

Closed
wants to merge 5 commits into from

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Apr 24, 2024

Fix #12873

Here is the codesandbox with the fix:

https://codesandbox.io/p/sandbox/priceless-shaw-g23c8w?file=%2Fsrc%2FDemo.tsx%3A57%2C24

It remains an edge case if you toggle before the animation is resolved. It that case, the animation is not played and the chars goes directly to the final state. Which is less problematic than stopping wright in the middle.

I don't know why animation stopped. I opened an issue on this topic: pmndrs/react-spring#2273

The current workaround make sure to keep the last different value in memory

@alexfauquette alexfauquette added bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module! labels Apr 24, 2024
@mui-bot
Copy link

mui-bot commented Apr 24, 2024

Deploy preview: https://deploy-preview-12892--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 17abb38

if (previousPathRef.current === null) {
return path;
}
return interpolateString(previousPathRef.current, path)(t);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping interpolateString(...) in a useMemo like it was before would be nice, it seems to do a bit of initialization work. If this runs on every frame and there's many charts animating at once, it could run less smoothly.

@JCQuintas
Copy link
Member

Lines and points animations aren't smooth anymore:

Click "Randomize" under the "Animation" part

eg: https://deploy-preview-12892--material-ui-x.netlify.app/x/react-charts/lines/#animation
vs: https://mui.com/x/react-charts/lines/#animation

@alexfauquette
Copy link
Member Author

Lines and points animations aren't smooth anymore:

It seems I can remove the imperative call to api.start which improve the sync

@alexfauquette alexfauquette marked this pull request as draft April 24, 2024 14:21
@alexfauquette
Copy link
Member Author

Moving to draft, because the logic leads to bugs with mouse hover. Will need to think back about it with a clearer mind

Screencast.from.24-04-2024.16.22.17.mp4

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 29, 2024
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module! PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[charts] LineChart transition stops before completion
4 participants