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

WIP: pie chart animation #3006

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ export class VictoryTransition extends React.Component<
if (!this.state) {
return this.props;
}
// This causes the following bug in victory pie:
// If nodes exit, we run the exit transition using the old props.
// This causes us to overwrite any new data values with old data values.
// For example, if oldProps has data: [1, 2, 3, 4, 6] and newProps has data: [5, 2, 3, 4],
// we end up with data: [1, 2, 3, 4, 0] after the exit transition (default exit transition for pie chart is
// before: () => ({ _y: 0 }), which causes the existing nodes to be set to 0).
return this.state.nodesWillExit
? this.state.oldProps || this.props
: this.props;
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-pie/src/victory-pie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class VictoryPieBase extends React.Component<VictoryPieProps> {
duration: 500,
before: () => ({ _y: 0, label: " " }),
after: (datum) => ({
y_: datum._y,
_y: datum._y,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

originally thought this was the bug fix, but it is still present after this change

label: datum.label,
}),
},
Expand Down
Loading