plotly / plotly.js

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

Hover box overlapping point/cursor #5097

Open johann-petrak opened 4 years ago

johann-petrak commented 4 years ago

With plotly express, when using hover_data, the hover box sometimes covers the point for which it is shown (depending on the size of the hover box). It would be good if this could get avoided by shifting the box. In many cases, it is clear before showing the plot, in which direction the hoever box could get shifted to better avoid this, so even if the javascript cannot figure this out automatically it would be good to allow something like "hover_box_delta_x", "hover_box_delta_y" to shift the box that many pixels to the right (if negative, to the left), for example.

When the box completely covers the cursor and the point it is shown for it is very hard to put the information in context and even harder to show the information for another point, because neighbouring points are not visible at all.

nicolaskruchten commented 4 years ago

Can you provide a reproducible example of when this happens please?

johann-petrak commented 4 years ago

The zip file contains a Jupyter notebook where the second scatter plot shows this behaviour. This notebook also demonstrates the problem described in issues https://github.com/plotly/plotly.py/issues/2476 and https://github.com/plotly/plotly.js/issues/4294

In issue https://github.com/plotly/plotly.js/issues/4294 you will also find a notebook that demonstrates how the same is done with hvplot: it shows all overlapping data points in the hover information and it breaks the text to avoid points getting covered by the hover box.

plotly_scatter_hover1.zip

gvwilson commented 2 months ago

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

johann-petrak commented 2 months ago

This is still a very important problem, I do not think that it should be closed just because nobody addressed it for a rather long time.

In my case it influenced my decision to use Bokeh instead for several projects where close or multiple identical points are an issue and plotly basically shows extremely incomplete and thus misleading information. I think others have commented about this problem also somewhere on the plotly discussion forums.