This repository has been archived by the owner on Feb 19, 2022. It is now read-only.
retain x, y, attributes in data for user convenience #188
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The formatted data now uses "_x" and "_y" to represent data for calculating values / positions etc. This PR adds "x" and "y" properties back, but in such a way that they will be overridden by "x" and "y" values if they exist in the data. This will cause fewer breaking changes for users working with data accessors, but also relying on functional props like
size={(d) => d.y > 2}
. So, formatted data will always have "x", "_x", "y", and "_y" where "_x" and "_y" are guaranteed to be in a format that Victory expects when working with x, y, data. "x" and "y" will be identical to "_x" and "_y" except in cases where "x" and "y" already exist in user data. In this case, user "x" and "y" will remain unchanged, allowing users to make assertions likesize={(d) => d.x === "cats"}
(_x
will have been mapped to an integer corresponding to a string map)