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

feat: pie animations #451

Merged
merged 6 commits into from
Dec 13, 2024
Merged

feat: pie animations #451

merged 6 commits into from
Dec 13, 2024

Conversation

zibs
Copy link
Contributor

@zibs zibs commented Dec 12, 2024

Description

Adds animations for pie charts

Screen.Recording.2024-12-12.at.11.54.16.AM.mov

Fixes #279

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Added simple animations to Donut Chart example

Checklist: (Feel free to delete this section upon completion)

  • I have included a changeset if this change will require a version change to one of the packages.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have run yarn run check:code and all checks pass
  • I have created a changeset for new features, patches, or major changes
  • I have added tests that prove my fix is effective or that my feature works
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@zibs zibs requested a review from keithluchtel December 12, 2024 20:01
Copy link

changeset-bot bot commented Dec 12, 2024

🦋 Changeset detected

Latest commit: 41c084b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
victory-native Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
victory-native-xl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 6:18pm

lib/src/hooks/useAnimatedPath.ts Outdated Show resolved Hide resolved
const { slice } = usePieSliceContext();
const [path, insetPaint] = useSliceAngularInsetPath({ slice, angularInset });

// If the path is empty, don't render anything
if (path.toSVGString() === "M0 0L0 0M0 0L0 0") {
Copy link
Member

Choose a reason for hiding this comment

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

is this a default value of a path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the value of an empty path of the angular inset, yes. I think there's an initial render that happens when all the values haven't been set/received yet higher up so it renders just a point. It's not the best solution, but it fixes the issue.

return (
<Path path={path} paint={insetPaint} {...rest}>
<Component path={path} paint={insetPaint} animate={animate} {...rest}>
Copy link
Member

Choose a reason for hiding this comment

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

thinking out loud. Would be nice in future cleanup if we could just always use AnimatedPath so we don't have to always check which component to render.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. There's potentially a perf hit of some sort, but it would definitely keep things a bit simpler.

@zibs zibs merged commit dc085bc into main Dec 13, 2024
3 checks passed
@zibs zibs deleted the feat/pie-animations branch December 13, 2024 18:23
@fmd-ci fmd-ci mentioned this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It’s possible build pie chart with animation in this version?
2 participants