Skip to content

feat: add option to prevent overlapping labels#1428

Merged
dangreen merged 7 commits intochartist-js:mainfrom
TNRIS:develop
Jun 27, 2025
Merged

feat: add option to prevent overlapping labels#1428
dangreen merged 7 commits intochartist-js:mainfrom
TNRIS:develop

Conversation

@L-Har
Copy link
Contributor

@L-Har L-Har commented Jun 4, 2024

Add an option to pie chart that can prevent overlapping labels. If preventOverlappingLabelOffset is Nonzero check if a label has overlapping text then move it the number of pixels up and left (Should be label size)

@L-Har
Copy link
Contributor Author

L-Har commented Jun 4, 2024

@evertheylen Would you mind taking a look at this pull request? I think this would be a useful option if it were to be added into the main branch.

@evertheylen
Copy link
Contributor

@L-Har the code looks good from a cursory glance but I'm not sure why you're asking me :)

@L-Har
Copy link
Contributor Author

L-Har commented Jun 4, 2024

@evertheylen Sorry about that, I thought you were a maintainer. Thanks for approving though

@L-Har
Copy link
Contributor Author

L-Har commented Jun 4, 2024

@gionkunz Would you mind reviewing this pull request?

@L-Har
Copy link
Contributor Author

L-Har commented Apr 11, 2025

@dangreen Hello. Would you mind taking a look at this pull request? It's just an implementation of a way to prevent overlapping labels in the pie chart. With an option to toggle it on if desired, and unit tests.

@dangreen dangreen self-requested a review April 11, 2025 15:05
@dangreen
Copy link
Collaborator

@L-Har Could you please rebase fork to fresh master?

@L-Har
Copy link
Contributor Author

L-Har commented Apr 11, 2025

@dangreen Hello Dan, Sure I can. I've went ahead and rebased this branch to main.

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 8.33333% with 11 lines in your changes missing coverage. Please review.

Project coverage is 73.51%. Comparing base (6ee19be) to head (46f5ef1).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/charts/PieChart/PieChart.ts 8.33% 11 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1428      +/-   ##
==========================================
- Coverage   74.24%   73.51%   -0.73%     
==========================================
  Files          42       42              
  Lines        1250     1265      +15     
  Branches      328      333       +5     
==========================================
+ Hits          928      930       +2     
- Misses        241      253      +12     
- Partials       81       82       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Dan Onoshko <danon0404@gmail.com>
@L-Har L-Har force-pushed the develop branch 2 times, most recently from 4726914 to 24d7c11 Compare April 14, 2025 14:32
@L-Har
Copy link
Contributor Author

L-Har commented Jun 13, 2025

Hey Dan, just wondering if I needed to do anything else to get this PR in chartist? I'm not sure about the size-limit automated test failing, but I'll check out that trailing whitespace automated check if needed.

@L-Har L-Har requested a review from dangreen June 17, 2025 15:28
@dangreen dangreen changed the title chore(labels): add option to prevent overlapping labels feat: add option to prevent overlapping labels Jun 27, 2025
Copy link
Collaborator

@dangreen dangreen left a comment

Choose a reason for hiding this comment

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

Also please run pnpm build && pnpm test:size and increase size in .size-limit.json

@L-Har
Copy link
Contributor Author

L-Har commented Jun 27, 2025

@dangreen Of course. Thanks for the tip on the size-limit. And the refactoring. It looked good. I squashed the commits and pushed the changes.

Copy link
Contributor Author

@L-Har L-Har left a comment

Choose a reason for hiding this comment

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

I like the suggested changes.

@dangreen dangreen merged commit 552bfca into chartist-js:main Jun 27, 2025
5 of 6 checks passed
@github-actions github-actions bot mentioned this pull request Jun 27, 2025
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.

4 participants