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

Functional styles / props are not evaluated properly for entering elements #460

Closed
chriswhong opened this issue Dec 22, 2016 · 4 comments · Fixed by FormidableLabs/victory-core#186

Comments

@chriswhong
Copy link

victorybar
I added animate to my VictoryBar, and am updating it with a new data based on a filtering UI. The user can eliminate an entire category from their filtering. When this happens, I am observing the following issues:

  1. The dynamically assigned colors do not get applied. (If I assigned yellow to the first category, and then eliminate that category from the data, the first bar remains yellow even though it now represents a different category... basically the bar's size is updating, but not it's style.

  2. If I then change the filters and add the category that was removed, a black bar appears in the last position (farthest right), and again the dynamic colors are not applied properly.

Any assistance is much appreciated! Thanks for a great package.

@chriswhong
Copy link
Author

Also, the numbers show many decimals when animating... how can I fix that? I tried adding converting to strings but it didn't help.

@chriswhong
Copy link
Author

This is probably the same issue as #374

@boygirl
Copy link
Contributor

boygirl commented Jan 2, 2017

@chriswhong I'm going to update the title of this issue. Animating with different number of points works except when functional styles are used to color the animating points.

i.e. this works:

<VictoryChart style={chartStyle} animate={{ duration: 1500 }}>
  <VictoryBar
    style={{data: {fill: "tomato"}}}
    data={this.state.barTransitionData}
  />
</VictoryChart>

but this doesn't

<VictoryChart style={chartStyle} animate={{ duration: 1500 }}>
  <VictoryBar
    style={{data: {fill: (d) => d.x % 2 === 0 ? "blue" : "tomato"}}}
    data={this.state.barTransitionData}
  />
</VictoryChart>

@boygirl
Copy link
Contributor

boygirl commented Jan 2, 2017

as for the numbers, something like labels={(d) => parseInt(d.y, 10)} will prevent that issue

@boygirl boygirl changed the title Animation does not function properly if the new data has more/fewer elements Functional styles / props are not evaluated properly for entering elements Jan 2, 2017
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 a pull request may close this issue.

2 participants