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

Workarounds for "common" (aka axis) hover label clipping #4298

Merged
merged 3 commits into from
Oct 25, 2019

Conversation

etpinard
Copy link
Contributor

resolves #4221


68521df - Under hovermode: 'x', the common hover label (i.e. the one on top of the x axis) is constrained into the viewport while the hover label arrow appear on the left or right edge.

Peek 2019-10-22 14-48


2c94e5f - Under hovermode: 'y', the common hover label for side:'left' y axes has its text shifted to the right so that its beginning is visible and then clipped so that it doesn't overlap the hover label arrow.

Peek 2019-10-22 14-51


cc @plotly/plotly_js

... and place hover label arrow to left or right of text box.
... so that their text start is visible in the graph's viewport
@etpinard etpinard added bug something broken status: reviewable labels Oct 23, 2019
@etpinard etpinard added this to the v1.51.0 milestone Oct 23, 2019
var clipPath;
var ltx;

if(lx < (tbb.width + 2 * HOVERTEXTPAD + HOVERARROWSIZE)) {
Copy link
Contributor Author

@etpinard etpinard Oct 23, 2019

Choose a reason for hiding this comment

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

@nicolaskruchten this used to be:

if(lx < (tbb.width + HOVERTEXTPAD + HOVERARROWSIZE)) { // ...

which may have caused the problem described in #4221 (comment)

New attempt: https://codepen.io/etpinard/pen/qBBrLwx

@archmoj
Copy link
Contributor

archmoj commented Oct 23, 2019

Very nice.
The only issue I noticed is one has multi-line labels the short lines may disappear like this codepen.

... so that each start-of-line is always visible.
@etpinard
Copy link
Contributor Author

The only issue I noticed is one has multi-line labels the short lines may disappear like this codepen.

@archmoj Thanks very much for spotting that! Here's how it looks like after the latest commit:

Peek 2019-10-24 15-09

https://codepen.io/etpinard/pen/eYYWyOw?editors=1010

Copy link
Contributor

@archmoj archmoj left a comment

Choose a reason for hiding this comment

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

@etpinard thanks very much for covering that!
Please find my question below.

src/components/fx/hover.js Show resolved Hide resolved
@archmoj
Copy link
Contributor

archmoj commented Oct 24, 2019

Nicely done.
💃 💃 💃

@etpinard
Copy link
Contributor Author

Thanks again for the review @archmoj - merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hoverlabel clipping should occur with 0 or tight margins
2 participants