plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.85k stars 1.85k forks source link

Hover & text on shapes #4780

Open nicolaskruchten opened 4 years ago

nicolaskruchten commented 4 years ago

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.

jorgenherje commented 2 years ago

@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

RichardNeill commented 10 months ago

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

iacisme commented 3 months ago

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

matanox commented 2 months ago

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.