Skip to content

Hover & text on shapes #4780

Description

@nicolaskruchten

We don't want layout shapes to be full traces but it would be pretty convenient to be able to add hoverlabels and text to them, for something like object-annotation or to label horizontal lines on plots.

Activity

  1. added this to the v1.5x.0 milestone on Apr 22, 2020
  2. jorgenherje commented on Jan 20, 2022

    @jorgenherje

    @nicolaskruchten Would be nice with hover text for shapes.

    Shapes are nice to utilize for marking/annotation in plots with vertical/horizontal lines. However it would be nice to have hover text, s.t. info is not visible at all times.

    Working in WebViz using Dash and plotly. I've been testing some ways to obtain vertical lines with text info, and found the two possible solutions so far:

    1. Shapes + annotations (text labels always visible - not optimal):
      image

    2. Vertical trace (must add after data, and calculate min and max y-value. Can become slow with many traces? And does not span across y-axis when zooming out):
      image

  3. RichardNeill commented on Nov 2, 2023

    @RichardNeill

    Agree, this would be great. If we can't have the full "hover" mechanism, what about enabling
    the HTML title attribute?

  4. iacisme commented on May 19, 2024

    @iacisme

    I'd like to bring this up as well. It'd be really cool if hover data could be added to vline or hline objects.

    image

  5. matanox commented on Jun 26, 2024

    @matanox

    I'm not aware there's any issue adding text in shapes these days, it's already a feature.

    However hover labels/text for shapes could be nice. Unless I'm using a shape as the wrong solution for overlaying a few bars behind a scatter plot (as bars already have hover texts). I guess not all shape drawing on charts need to rather be data instead of drawing, otherwise why have shapes at all. But the feature set gradient between plotted data and plotted shapes which aren't data ― it sure implies careful decision making.

  6. self-assigned this
    on Jul 8, 2024
  7. removed their assignment
    on Aug 2, 2024
  8. jaladh-singhal commented on Jul 16, 2026

    @jaladh-singhal

    This will be super useful for charts that rely on shapes (like line, rectangle) as markers to see more info about a marker. In my case, I cannot add a hidden decorative scatter trace to emulate hover tip behavior.

    Are there any plans to implement it in the near future? As of plotly.js v3.6, shapes already support label/text so I'm anticipating if it will come next (given that annotations also support hover tips)?

  9. robertclaus commented on Jul 27, 2026

    @robertclaus

    This would be a really interesting issue for an ambitious community member to open a PR for!

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions