-
Notifications
You must be signed in to change notification settings - Fork 524
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
fix: dedup data for <VictoryStack/>
#2898
Open
r281GQ
wants to merge
5
commits into
main
Choose a base branch
from
fix-stack-data
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 48fd666 The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 packages
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 |
r281GQ
changed the title
fix: dedup data for
WIP - fix: dedup data for Sep 12, 2024
<VictoryStack/>
<VictoryStack/>
r281GQ
changed the title
WIP - fix: dedup data for
fix: dedup data for Sep 13, 2024
<VictoryStack/>
<VictoryStack/>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
That is a tricky issue. The problem is with AreaCharts (or LineCharts) when we use them in stacked mode.
We opt-in for stack mode by wrapping the Chart in the
<VictoryStack />
component.VictoryStack modifies the underlying data which makes AreaChart behave a bit different (draws different area) compared to when it's used on it's own. Only when given invalid data.
What is invalid data? For LineCharts and AreaCharts we can assume data is invalid/bad/corrupt when to elements have identical
x
values.Therefore the main responsibility and final call should be of the library user to provide clean data.
However, with a little change we can make the AreaChart provide the same fallback with or without the usage of Stack.
That is to dedup the data. One objection might be, we don't know the identity function for all given data, i.e. how do we know two elements are equal.
In Victory we already assume the identity of the data:
We can dedup the elements and removing duplicate instances from the stack.
Fixes #2883 or rather addresses it.
Type of Change
How Has This Been Tested?
Manually and adding jest test for testing the dedup logic.
Manually
Before
After
Jest
Created a new suite to mock almost all calls out, expect for the
fillData
function that has been modified.Checklist: (Feel free to delete this section upon completion)