Hovertext not displaying in Plotly Bargraph trace

Viewed 62

The bars will all plot, but the hovertext and text will not display at all. I have tried hover formatting, text display, hovertemplate, etc.....

fig.add_trace(go.Bar(
                    x=date, y=[num], name=x, width=10, opacity=0.6,
                    hovertext="Position: " + str(num), text=str(num), hovertemplate=
                    '<b>%{text}</b>',
                    marker_color='rgb(158,202,225)', marker_line_color='rgb(8,48,107)',
                    marker_line_width=10
                ), secondary_y=True)

I also tried formatting text inside the bars which also didn't work

 fig.add_trace(go.Bar(
                    x=date, y=[num], name=x, width=10, opacity=0.6, textposition='inside',
                    hovertext="Position: " + str(num), text=str(num),
                    marker_color='rgb(158,202,225)', marker_line_color='rgb(8,48,107)',
                    marker_line_width=10
                ), secondary_y=True)

Here is where I make the subplots (2 different y-axis but they share the x-axis)

fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.update_yaxes(title_text="<b>Blah blah</b>", secondary_y=False, nticks=20, title_font_size=20)
fig.update_yaxes(title_text="<b>Blah blah 2</b>", secondary_y=True, nticks=20, title_font_size=20)

I also made sure to call fig.show() and everything graphs properly, I just cannot get the hovertext on bar graphs. Thanks!

0 Answers
Related