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

Fit center-aligned hover labels within graph's horizontal span #3681

Merged
merged 2 commits into from
Mar 26, 2019

Conversation

etpinard
Copy link
Contributor

fixes #3654

updated codepen: https://codepen.io/etpinard/pen/bZJNBj

cc @plotly/plotly_js

var overflowR = htx + txHalfWidth - outerWidth;
var overflowL = htx - txHalfWidth;
if(overflowR > 0) htx -= overflowR;
if(overflowL < 0) htx += -overflowL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Beautiful! It makes sure we never have an overflow on the left which is perfect for languages that read left to right.

One day, we should allow reversing that order for languages that read right to left 😸

@antoinerg
Copy link
Contributor

Thank you for the fix @etpinard! It looks good to me 💃

@etpinard etpinard merged commit 577f831 into master Mar 26, 2019
@etpinard etpinard deleted the fit-hover-label-within-graph branch March 26, 2019 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pie chart hover label hidden
2 participants