Skip to content

Hoverlabel clipping should occur with 0 or tight margins #4221

Closed

Description

@nicolaskruchten

Right now it's possible for various plot elements to clip when margin is set to 0, for example the hoverlabel on the axis in hovermode: closest

image

Activity

  1. changed the title [-]No clipping should occur with 0 or tight margins[/-] [+]Hoverlabel clipping should occur with 0 or tight margins[/+] on Sep 26, 2019
  2. added this to the v1.51.0 milestone on Sep 26, 2019
  3. nicolaskruchten commented on Sep 26, 2019

    @nicolaskruchten
    ContributorAuthor

    This also happens in the horizontal case:

    image

  4. nicolaskruchten commented on Sep 26, 2019

    @nicolaskruchten
    ContributorAuthor

    Related #3607

  5. etpinard commented on Oct 4, 2019

    @etpinard
    Contributor

    What would be the best solution here?

    1. should we fit the hover label into viewport, and then possibly tweak the tip shape?
    2. should we truncate the hover label text and add ellipses?

    I'd vote for 1), but please let me know if you disagree or have a better solution in mind.

  6. nicolaskruchten commented on Oct 7, 2019

    @nicolaskruchten
    ContributorAuthor

    When the axis is perpendicular to the edge (second screenshot) then just moving the hoverlabel such that it fits would work I think. When the axis is parallel to the edge (first screenshot) I think ellipses will be needed? hard to imagine what else we can do in this case.

  7. etpinard commented on Oct 11, 2019

    @etpinard
    Contributor

    Might be nice to explore solutions to #3985 at the same time as this ticket.

  8. self-assigned this
    on Oct 16, 2019
  9. etpinard commented on Oct 22, 2019

    @etpinard
    Contributor

    Here's a first attempt:

    https://github.com/plotly/plotly.js/compare/common-label-overlaps


    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.

    https://codepen.io/etpinard/pen/NWWpPmq

    Peek 2019-10-22 14-48


    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.

    https://codepen.io/etpinard/pen/LYYWEvr

    Peek 2019-10-22 14-51

  10. nicolaskruchten commented on Oct 22, 2019

    @nicolaskruchten
    ContributorAuthor

    Re https://codepen.io/etpinard/pen/NWWpPmq the hoverlabels look great but the axis label is pretty clipped ;P

  11. nicolaskruchten commented on Oct 22, 2019

    @nicolaskruchten
    ContributorAuthor

    Re https://codepen.io/etpinard/pen/LYYWEvr when I set automargin there's still a tiny bit of clipping on the "Way longer" one.

  12. etpinard commented on Oct 22, 2019

    @etpinard
    Contributor
  13. etpinard commented on Oct 22, 2019

    @etpinard
    Contributor

    the hoverlabels look great but the axis label is pretty clipped

    Yes, it was much easier to show the new behaviour w/o setting automargin: true

    Re https://codepen.io/etpinard/pen/LYYWEvr when I set automargin there's still a tiny bit of clipping on the "Way longer" one.

    Where?

    Peek 2019-10-22 15-21

    taken off https://codepen.io/etpinard/pen/GRRWJMg

  14. nicolaskruchten commented on Oct 22, 2019

    @nicolaskruchten
    ContributorAuthor

    Here's what it looks like in Chrome/MacOS on your pen:

    image

  15. etpinard commented on Oct 23, 2019

    @etpinard
    Contributor

    Here's what it looks like in Chrome/MacOS on your pen:

    Ok, that's odd. How does it look like w/o automargin: true e.g. using https://codepen.io/etpinard/pen/LYYWEvr ?

  16. nicolaskruchten commented on Oct 23, 2019

    @nicolaskruchten
    ContributorAuthor

    Looks fine there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions