Skip to content

Hover rules for period-positioned traces #5553

Closed

Description

@nicolaskruchten

These invariants should hold for period-positioned traces (the word "point" below should be taken to mean scatter marker or bar or whatever other kind of period-positioned mark we have) in both compare and unified hovermodes:

  • a period-positioned point must not "win the hover" if the cursor is not within the period that the point represents (i.e. a scatter point with x='2010-02-15', xperiod='M1', xperiodalignment='start' must not win the hover even if the cursor is extremely close to it on the left side)
  • a period-positioned point must be in the "hover set" (for compare or unified hover modes) if the point that wins the hover is within the period that the point represents (i.e. a scatter point with x='2010-02-15', xperiod='M1', xperiodalignment='start' must be in the hover set if the cursor is positioned at March 2 and the non-period-positioned point that won the hover is at Feb 28)

cc @alexcjohnson

See also #5292

Activity

  1. nicolaskruchten commented on Apr 20, 2021

    @nicolaskruchten
    ContributorAuthor

    Open questions:

    1. does the code already basically intend to do this?
    2. do we need to find specific cases where these are not met?
  2. archmoj commented on Apr 27, 2021

    @archmoj
    Contributor

    The behaviour using v2.0.0-rc.1 appears to be correct.
    Here is a codepen.

  3. nicolaskruchten commented on Apr 27, 2021

    @nicolaskruchten
    ContributorAuthor

    Funny observation regarding the codepen above: if I turn spikelines on, it's easy to get the spikelines on the bar but not the black axis-hoverlabel.

    I think this exposes an additional implicit invariant: the "winning point" is the one that gets both the spikeline and the black axis-hoverlabel, right @alexcjohnson ?

  4. nicolaskruchten commented on Apr 27, 2021

    @nicolaskruchten
    ContributorAuthor

    Also, I notice that the spikeline behaves differently in compare and unified modes: the spikeline in compare mode seems to want to stick to the bar, but in unified mode it has the behaviour I think I would expect.

    I think that the relationship between unified hovermode and spikelines is that we coerce the spikedistance and/or spikesnapdistance when we set hovermode to unified. The spikeline behaviour in unified mode seems better to me, but maybe there is some additional context around spikeline/snapping behaviour that I don't know about.

  5. nicolaskruchten commented on Apr 27, 2021

    @nicolaskruchten
    ContributorAuthor

    Re spikeline and winning point: there is the xaxis.spikesnap attribute which does not default to hovered data (although maybe it should, as part of 2.0?). I'll note that setting it to "hovered data" doesn't actually cause the winning point and spiked point to match :)

    Also, in the codepen above, hovering on the left-most bar at exactly the center produces TWO orange hoverlabels in compare mode!

    image

  6. nicolaskruchten commented on Apr 27, 2021

    @nicolaskruchten
    ContributorAuthor

    Additionally: hovering over the exact center of the right-most bar causes the wrong point in the orange trace to be in the set! Oddly, this does not happen when I set the bar trace's xhoverformat="%m" (so we're doing string matching?)

    image

  7. added
    bug
    on Apr 29, 2021
  8. nicolaskruchten commented on Apr 29, 2021

    @nicolaskruchten
    ContributorAuthor

    Let's ignore anything to do with spikelines in this issue and have that conversation in #5619

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions