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

feat: CategoryBar now supports values more than 100 or less than 100 (while more than 1) #1036

Merged
merged 6 commits into from
May 19, 2024

Conversation

lcandy2
Copy link
Contributor

@lcandy2 lcandy2 commented May 8, 2024

Description
This pull request brings the CategoryBar component to support values with any sum, whereas the previous one required the values sum to be exactly 1 or 100.

By dynamically normalizing the input values to represent each category proportionally, regardless of the total, this enhancement increases flexibility and applicability in a variety of data environments. Additional unit tests ensure proper functioning in a variety of situations.

Related issue(s)
#1035

What kind of change does this PR introduce? (check at least one)

  • Bug fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • New Feature (BREAKING CHANGE which adds functionality)
  • Refactor
  • Build-related changes
  • Other, please describe: typo fix

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

How has this been tested?

  • I have added unit test in src/tests/vis-elements/CategoryBar.test.tsx via jest and it passes all the tests.
  • I have added two storybook examples in src/stories/vis-elements/CategoryBar.stories.tsx and it works as expected.

You may visit the following link to learn about storybook:

With Values More Than 100 (https://tremor-storybook-git-fork-lcandy2-main-tremor.vercel.app/?path=/story/visualizations-vis-categorybar--with-values-more-than-100)
With Values Less Than 100 (https://tremor-storybook-git-fork-lcandy2-main-tremor.vercel.app/?path=/story/visualizations-vis-categorybar--with-values-more-than-100)

Screenshots (if appropriate):

The screenshot values sum more than 100 (live):
CleanShot 2024-05-08 at 14 41 07@2x
The screenshot values sum less than 100 (more than 1) (live):
CleanShot 2024-05-08 at 14 41 12@2x

The PR fulfils these requirements:

  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the related issue section above
  • My change requires a change to the documentation. (Managed by Tremor Team)
  • I have added tests to cover my changes
  • Check the "Allow edits from maintainers" option while creating your PR.
  • Add refs #XXX or fixes #XXX to the related issue section if your PR refers to or fixes an issue.
  • By contributing to Tremor, you confirm that you have read and agreed to Tremor's CONTRIBUTING.md guideline. You also agree that your contributions will be licensed under the Apache License 2.0 license.

Copy link

vercel bot commented May 8, 2024

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

Name Status Preview Comments Updated (UTC)
tremor-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 19, 2024 8:14pm

@severinlandolt severinlandolt self-requested a review May 13, 2024 15:25
@severinlandolt severinlandolt added the PR: Under Consideration Has potentially wider implications which are being discussed label May 13, 2024
@severinlandolt severinlandolt self-assigned this May 19, 2024
@severinlandolt severinlandolt added PR: In Review This PR is in the process of being reviewed by the team and removed PR: Under Consideration Has potentially wider implications which are being discussed labels May 19, 2024
@severinlandolt severinlandolt changed the base branch from main to beta May 19, 2024 19:33
@severinlandolt
Copy link
Member

Good stuff! Thank you @lcandy2 for this contribution. Planned for v3.17.

@severinlandolt severinlandolt merged commit 1e2b662 into tremorlabs:beta May 19, 2024
4 checks passed
Copy link

🎉 This PR is included in version 3.17.0-beta.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: In Review This PR is in the process of being reviewed by the team released on @beta
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants