plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Hovertemplate box does not show when there is a lot of text.

Open Fmosella opened this issue 4 years ago • 1 comments

I am trying to display a very long hovertemplate box in my chart but I noticed that it does not show when there is a lot of break line <br> in it.

example:

import pandas as pd
import numpy as np
import plotly.graph_objects as go

np.random.seed(1)
s = pd.Series(np.random.normal(0, 1, size=10))

text = "a<br>"*100
customdata = s.copy()
customdata.iat[0] = text

fig = go.Figure()
fig.add_bar(
    x=s.index,
    y=s,
    customdata=customdata,
    hovertemplate="<b>%{x}</b><br>%{customdata}<extra></extra>"
)

You can try to put your mouse on the first bar, the box will not appear.

Is there a solution to fix this?

Fmosella avatar Sep 07 '22 07:09 Fmosella

Hi @Fmosella. It appears that the hover box no longer appears once the text it contains has more rows than can fit on the screen, which for me is around 54. This is quite a reasonable upper limit for a hover box, and I doubt many Plotly users will ever even approach that limit, so I don't think this should be considered a bug.

AaronStiff avatar Feb 10 '23 14:02 AaronStiff