Hi there!
I wish to have a hovertemplate where I can select different columns of my dataframe.
I wrote a function to create a trace line for several subplots.
def add_trace_line(figure_object, df, x, y, row_nr, col_nr, scattertype, line_color, width, name, opacity=1):
_height = df['height']
_thickness1 = df['thickness_1']
_thickness2 = df['thickness_2']
_hovertemplate = ('<i>Value</i>: %{y:.2f}'+
'<br><b>Height</b>: %{_height}<br>'+
'<br><b>Thickness 1</b>: %{_thickness1}<br>'+
'<br><b>Thickness 2</b>: %{_thickness2}<br>'+
'<br><b>KM</b>: %{x}<br>')
if scattertype == 'line':
if row_nr != 0:
return figure_object.add_trace(go.Scatter(x=x,
y=y,
hovertemplate = _hovertemplate,
line_color=line_color,
line=dict(width=width),
name=name,
opacity=opacity,
), row=row_nr, col=col_nr)
However, this does not work.
Hence, how can I select multiple columns of my dataframe and show them when hovering?
Thank you in advance!