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

fix/bars-disappear-on-zoom #2970

Merged
merged 8 commits into from
Nov 18, 2024
Merged

fix/bars-disappear-on-zoom #2970

merged 8 commits into from
Nov 18, 2024

Conversation

nstolpe
Copy link
Contributor

@nstolpe nstolpe commented Nov 14, 2024

Description

Addresses the issue where bar chart items more than 50% out of their chart area when zoomed disappear completely, as the bar middle point was being used to determine whether they should be culled from view.

Fixes # 2905

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist: (Feel free to delete this section upon completion)

  • I have included a changeset if this change will require a version change to one of the packages.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have run all builds, tests, and linting and all checks pass
  • I have added tests that prove my fix is effective or that my feature works
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Original video from issue:

372569985-a4f28103-efec-4b80-8af0-52fc8f809142.mov

Video after fix:

Screen.Recording.2024-11-18.at.10.00.56.AM.mov

Copy link

vercel bot commented Nov 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
victory ✅ Ready (Inspect) Visit Preview Nov 18, 2024 9:14pm

Copy link

changeset-bot bot commented Nov 14, 2024

🦋 Changeset detected

Latest commit: 210b9b0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
victory-bar Patch
victory-core Patch
victory-canvas Patch
victory-histogram Patch
victory Patch
victory-area Patch
victory-axis Patch
victory-box-plot Patch
victory-brush-container Patch
victory-brush-line Patch
victory-candlestick Patch
victory-chart Patch
victory-create-container Patch
victory-cursor-container Patch
victory-errorbar Patch
victory-group Patch
victory-legend Patch
victory-line Patch
victory-pie Patch
victory-polar-axis Patch
victory-scatter Patch
victory-selection-container Patch
victory-shared-events Patch
victory-stack Patch
victory-tooltip Patch
victory-voronoi-container Patch
victory-voronoi Patch
victory-zoom-container Patch
victory-native Patch
victory-vendor Patch

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

@nstolpe
Copy link
Contributor Author

nstolpe commented Nov 14, 2024

@carbonrobot this fixes the issue in 2905, in a way that I don't think is going to conflict with anything else. There's a lot of jumping around in logic, from the actual component class, to its helper methods, into data, and into domain as well. I don't think this the best way to fix it in terms of code maintainability and understandability, but I think to have a better fix would require a larger refactor, which seems like something coming in the future. There might also be a slightly cleaner check than component.type.displayName, I'll take a look into that refactor once I get your thoughts and see if you'd definitely like to go this route.

Copy link
Contributor

github-actions bot commented Nov 15, 2024

Folder/File Previous size New size Difference
/packages/victory/dist/victory.min.js 385.59KB 385.76KB +0.17KB (+0.04%)
TOTAL +0.17KB

@nstolpe
Copy link
Contributor Author

nstolpe commented Nov 15, 2024

After seeing @nlkluth's solution here, I gave a try at subclassing VictoryBar and overriding renderData, getBaseProps and getCalculatedValues from the EventsMixin in the derived class to see if this could be accomplished without modifying internal packages (aside from exposing an export or 2). Unfortunately, the overrides got out of control, each additional one triggering an error that required another. I think what's here might be the best way to go at this point.

Copy link
Member

@nlkluth nlkluth left a comment

Choose a reason for hiding this comment

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

These events are tough to parse -- Nice job! One little comment that is not blocking 👍

nlkluth
nlkluth previously approved these changes Nov 18, 2024
packages/victory-bar/src/helper-methods.ts Outdated Show resolved Hide resolved
@nstolpe nstolpe requested a review from nlkluth November 18, 2024 22:02
@nstolpe nstolpe merged commit 22fa244 into main Nov 18, 2024
7 checks passed
@nstolpe nstolpe deleted the fix/bars-disappear-on-zoom branch November 18, 2024 22:30
@nstolpe nstolpe linked an issue Nov 18, 2024 that may be closed by this pull request
2 tasks
@github-actions github-actions bot mentioned this pull request Nov 20, 2024
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 this pull request may close these issues.

Make bars always visible while zooming
2 participants