Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Accessing customdata with the hovertemplate via scattermapbox plot-

$
0
0

Having some issues grabbing the customdate with a hovertemplate in a scattermapbox trace. Here is a snippet of code I have:

fig = go.Figure(data=go.Scattermapbox(
    lon=[data.start_lon],
    lat=[data.start_lat],
    customdata = [data.start_head,data.sog],
    mode='markers',
    marker = dict(
        color=display['primary_point']['color'],
        size=display['primary_point']['size'],
    ),
    name='Initial Point',
    text = 'Initial Point',
    hovertemplate=
    "<extra></extra><b>%{fullData.name}</b><br>" +
    "Longitude: %{lon}<br>" +
    "Latitude: %{lat}<br>" +
    "Heading: %{customdata[0]}<br>"

    ))

When I hover over that, the “Heading” portion literally says ‘%{customdata[0]}’. If I take off the index (i.e. [0]), and just say customdata, it points it at the first item in the list. Any thoughts? (data is just a class I store variables in)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images