GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(bar): prevent outside text labels from overlapping tilted axis ticks by vizansh · Pull Request #7872 · plotly/plotly.js

Conversation

@vizansh

@vizansh vizansh commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #7822

This pull request dynamically calculates the positioning for bar chart text labels when textposition='outside'.

Instead of using a static pixel margin, it looks up the active axis configuration and utilizes .getBBox() to measure the exact live dimensions of the tilted or long axis labels. It then shifts the bar numbers by that precise footprint plus a clean visual buffer, entirely preventing overlaps with the top/right axis ticks.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
vizansh added 2 commits June 28, 2026 01:04
@vizansh
fix(bar): prevent outside text labels from overlapping tilted axis ticks
dbc9a51
@vizansh
chore: add draftlog for bar text overlap fix
8c78dd6
@camdecoster camdecoster assigned emilykl Jul 2, 2026
@camdecoster

camdecoster commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR! Our team will review and provide feedback.

vizansh reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vizansh
fix: add required PR link formatting to draftlog
9ea39bc
@vizansh

vizansh commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Hi maintainers, could someone please approve and trigger the GitHub Actions workflow for this PR? I'd love to make sure all the automated CI/CD tests pass successfully. Thank you!

vizansh reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@camdecoster

camdecoster commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Until we get to this review, could you please look into the test failures and see if anything is broken/needs to be updated?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@emilykl

emilykl commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Hi @vizansh ! I just spent some time reviewing the original issue #7822, and posted a comment with my thoughts on the root cause and the best approach for a fix. I think the best fix will require a different approach than what you've done here.

Please feel free to continue working and pursue one of the fix approaches outlined in my comment if you like, or propose another approach. I'm happy to review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@emilykl emilykl assigned vizansh and unassigned emilykl Jul 15, 2026
vizansh added 3 commits July 16, 2026 04:50
@vizansh
fix(bar): keep zero-value outside labels on one side
6b1363e
@vizansh
fix: export toMoveOutsideBar
73c8ab5
@vizansh
fix: rename draftlog file to match PR 7872
a61530b
@vizansh

vizansh commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

/review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 29, 2026
View reviewed changes
Comment thread src/traces/bar/plot.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 29, 2026
View reviewed changes
Comment thread src/traces/bar/plot.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 29, 2026
View reviewed changes
Comment thread src/traces/bar/plot.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 29, 2026
View reviewed changes
Comment thread src/traces/bar/plot.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 29, 2026
View reviewed changes
Comment thread test/jasmine/tests/bar_test.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 29, 2026
View reviewed changes
Comment thread src/traces/bar/plot.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl suggested changes Jul 29, 2026
View reviewed changes

@emilykl emilykl left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@vizansh Nice work! I think this is ready to merge once my comments are addressed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
emilykl
emilykl reviewed Jul 29, 2026
View reviewed changes
Comment thread draftlogs/7872_fix.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

vizansh and others added 3 commits July 30, 2026 18:36
@vizansh @emilykl
refactor: apply reviewer suggestions for zeroBarDir
f291d70
Co-authored-by: Emily KL <[email protected]>
@vizansh @emilykl
Apply suggestions from code review
33e4357
Co-authored-by: Emily KL <[email protected]>
@vizansh
fix: remove trailing comma in export object
a318a80
@vizansh
vizansh requested a review from emilykl July 30, 2026 14:29
@vizansh

vizansh commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Hi @emilykl! Thank you so much for the detailed review and guidance! Those remaining inline errors were just leftover artifacts from my very first commit attempt. All of your suggested refactors and cleanups have been applied in the latest commits. Ready for another review whenever you have a moment! Thanks again for all your help!

vizansh reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 30, 2026
View reviewed changes
Comment thread src/traces/bar/plot.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 30, 2026
View reviewed changes
Comment thread src/traces/bar/plot.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 30, 2026
View reviewed changes
Comment thread src/traces/bar/plot.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@emilykl

emilykl commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@vizansh A couple more cleanup suggestions to apply, then this should be good. I tried applying them myself but got an error so hopefully it works on your side. Thanks for the quick response!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vizansh and others added 3 commits July 30, 2026 23:16
@vizansh @emilykl
Update src/traces/bar/plot.js
0758f06
Co-authored-by: Emily KL <[email protected]>
@vizansh @emilykl
Update src/traces/bar/plot.js
1579ed8
Co-authored-by: Emily KL <[email protected]>
@vizansh
fix: remove duplicate zeroBarDir in plot.js
79c20f8
Removed redundant zeroBarDir assignment and adjusted targetX/Y calculations to eliminate axisPad.
@vizansh
vizansh requested a review from emilykl July 30, 2026 18:13
@vizansh

vizansh commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Hi @emilykl! All the requested cleanups (axisPad reference removed, angle export restored, and duplicate zeroBarDir cleaned up) have been applied in the latest commits. Ready for your final review whenever you have a moment. Thanks again for all your guidance!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

emilykl
emilykl reviewed Jul 30, 2026
View reviewed changes
Comment thread draftlogs/7872_fix.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

@emilykl
add attribution to draftlog
d0ded0d
emilykl
emilykl approved these changes Jul 30, 2026
View reviewed changes

@emilykl emilykl left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks very much @vizansh for the contribution and the quick follow-ups! 🎉 Looks great.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@emilykl
emilykl merged commit 9cb20f0 into plotly:master Jul 30, 2026
164 of 165 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@vizansh
vizansh deleted the fix-bar-label-overlap branch July 31, 2026 15:14
@vizansh

vizansh commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Thank you so much @emilykl for the guidance, reviews, and the shoutout! I really appreciated working on this with you. Looking forward to contributing more in the future!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lukasmasuch lukasmasuch mentioned this pull request Oct 30, 2026
[BUG]: Bar traces draw in O(n²) time since v4.0.0 (getZeroBarDir runs once per bar) #8157
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@emilykl emilykl emilykl approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@vizansh vizansh

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[BUG]: Bar labels overlap with top/right axis labels with textposition=outside

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vizansh @camdecoster @emilykl
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.