Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

No hoverinfo text when height is too short

I have a scatter plot that uses the text attribute to display info about points when they are hovered over. 97 out of 100 entries work as intended, but 3 don’t. The 3 where hover doesn’t work at all all have longer lengths in their entries in the hoverText array.

Has anyone else encountered this and have an idea of a fix? It’s a game breaker for my plot right now because the amount of hoverinfo to display depends on the values at that data point.

Edit: using the above string, if I reduce the number of
tags by 1 to a total of 7 instead of 8, it works. However, if I add the tag back plus text after it, it breaks again. Seems like it’s a hoverinfo box height issue or something along those lines, not sure.

Strange. Can you share a fully reproducible example – that includes your x and y data - to help debug?

I have posted an identical question with a MRE over on SO…
http://stackoverflow.com/questions/43144245/tooltip-not-working-on-chart-depending-on-chart-size

It looks like plotly/ggplot cannot display a tooltip if the top edge of the tooltip box would extend above the chart area, into the title bar, and above. It is a total deal breaker on facet charts with lots of facets. Plotly should be able to autoslide the tooltip box down if necessary. It handles this ok when the tooltip would extend out over the right hand edge of the chart (by autosliding the box left) although it right justifies the tooltip contents in the process but I could live with that.

Thanks for the replys. LCaffrey’s description sounds accurate. Here’s a codepen example, http://codepen.io/anon/pen/aJPxEd. Notice the 2nd circle doesn’t actually show the hover text. However, increase the height to 600 and it will.

Yes, it is the same problem that I am having. It won’t display the second tooltip because it is “too big” for the space and it lies outside the bounds of the chart. It won’t “float” on the chart. This might not be such an issue on a large chart. but it causes the tooltips to be redundant on a facet chart lots of facets (i.e. where the chart of each facet is shallow)
In the absence of any suggestions, the only way that I can see of working around this behaviour is to ensure that the tootip is no more that 1 or two lines deep.

That’s the intended behavior at the moment unfortunately. We explicitly don’t draw hover labels that don’t fit in the SVG container (dimensions set by layout.width and layout.height).

We could try using custom hover labels (see docs) to draw the hover labels in an other container (which would be bigger than the graph’s SVG).

That’s what I figured. However, there’s sort of a second issue here. I updated http://codepen.io/anon/pen/aJPxEd with a change to the yaxis. In my actual plot, I have some data points near the top of the plot. The plot is rather large and can easily fit hovers for points in the middle of it, but, if they are drawn at the top then no hover is shown.

In the codepen, try changing the 2nd y value from 9 to 3. Notice it draws in the latter but not the former. That’s something that I would expect to work given your description of the intended functionality. The hoverinfo would need to be shifted down to account for the location of the data point.