Black Lives Matter. Please consider donating to Black Girls Code today.

Advanced Hover Template

Hello Pros!

I have a problem to modify the hover template.

I choose the data over dropdown buttons.
The drawing works put I can’t show not plotted data in the hover.

I want to show the data row and row2 both are lists in the hover.

In the plot I see only the variables row, row2

I hope someone can help me.

Best regards from Germany,
Christoph

def build_graph(x_axis, y_axis):
    x = data.csvreader()[f'{x_axis}'] # x = ['1', '2', '3', '4']
    y = data.csvreader()[f'{y_axis}'] # y = ['10', '20', '30', '40']

    row = data.csvreader()['row']   # row = ['3', '5', '6', '7']
    row2 = data.csvreader()['row2']  #row2 = ['2', '4', '8', '9']

    fig = go.Figure()


    fig.add_trace(go.Scatter(
        x=x,
        y=y,
        mode='markers',
        hovertemplate=
        "<b>%{x}</b><br><br>" +
        "Text1: %{row}<br>" +
        "Text2: %{row2}<br>" +
        "<extra></extra>",
        ))

    return fig