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

Data accessors not evaluated independently #451

Closed
Zerim opened this issue Dec 15, 2016 · 2 comments · Fixed by FormidableLabs/victory-core#185, FormidableLabs/victory-chart#426 or FormidableLabs/victory-pie#127
Assignees

Comments

@Zerim
Copy link

Zerim commented Dec 15, 2016

I came across this issue while attempting to reverse the axis for the chart shown here.

The VictoryBar can have it's axis reversed by setting the VictoryGroup horizontal prop to true. The VictoryVoronoi, however, needs to manually modified by switching it's x and y accessors.

As you can see from opening up the console on this fiddle, the x accessor is actually mutating the input to the y accessor. The behavior is quite confusing upon first encounter.

The workaround, as shown here, is to create an intermediate value in the data set, using a key that does not have special meaning such as 'x' or 'y'.

I imagine this was done for performance reasons. At the very least it seems worth documenting, as I'm sure others may get tripped up on this as well.

Thanks for the great library!

@boygirl
Copy link
Contributor

boygirl commented Dec 15, 2016

@Zerim Thanks for this issue. I've been thinking for a while that Victory should use a more careful internal namespace for the x and y values it actually plots. Something like xVictory, yVictory so that it doesn't get muddied with the very common x, y data keys. This will be an annoying bit of work, but I think this issue is the tipping point for me.

@boygirl boygirl self-assigned this Dec 15, 2016
@Zerim
Copy link
Author

Zerim commented Dec 15, 2016

@boygirl No problem, glad it was helpful. Maybe you could prefix whatever the new variables names are with underscores, to add an extra level of clarity that these are for internal use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants