Skip to content

Show only the series under the mouse in the hover label of a grouped line #159

Open

Description

@jvdd

Need

A user shows one line per run for about 100 process runs (#88). A hover shows a label for every run at the hovered x. The user wants a label for the run under the mouse only.

Current state

  • _figure_hovermode (flexviz/adapters/plotly_adapter.py) sets Plotly's hovermode to "x", or to "y" when every trace in the figure is horizontal. In "x" mode, Plotly labels every trace that has a point at the hovered x. A grouped line with 100 children gives up to 100 labels.
  • "x" suits histograms and bars: the whole column under the mouse picks the bar.
  • A user can already override the mode per figure: dash.add_figure(hovermode="closest"). The adapter merges user layout keys over its own layout. The docs do not mention this.
  • Linked hover (flexviz/adapters/js/runtime/hover.js, flexviz/adapters/js/plotly/hover.js) starts from plotly_hover.

What is needed

  1. Default. Choose the hover mode per figure from its traces. For example, use "closest" when the figure has a grouped line, and keep "x" or "y" for histograms and bars. A figure with both needs a rule.
  2. Linked hover. Check that the guides in other figures still follow the hovered point in "closest" mode.
  3. Docs. Show the hovermode override in docs/guides/customizing.md.
  4. Tests. Extend the hovermode tests in tests/test_adapters.py. Add a browser check that a hover on a grouped line shows one label.

Activity

  1. added
    enhancement
    on Oct 8, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions