Skip to content

Customdata missing in hoverdata in Ploly 6.0.0 #7375

Open
@Hermeij

Description

@Hermeij

I have written an app in Python using Dash 2.18.2. In that app I have a map with a cycling track and several graphs to show distance vs. speed, distance vs. power etc. I have written an JS-script to show hover-info on the graphs when hovering over the map and vice versa. I use therefore 'customdata' that is encapsulated in the hoverdata. with this Dash code:

        customdata = np.stack((df0['Dist'], overall_focus, df0['Lons'], df0['Lats']), axis=1)
        hovertemplate=('Dist: %{customdata[0]:.1f}<br>'+
                      focus+': '+ '%{customdata[1]:.1f}<br>'+
                      '%{customdata[2]:.6f}<br>'+
                      '%{customdata[3]:.6f}<br>'+
                      '<extra></extra>')
       
    
        # Create the scatter map figure with plotly.express
        fig_trck = px.scatter_map(
            map_style=map_mode,
            center={'lat': center[1], 'lon': center[0]},
            zoom=zoom,
            lat=overall_lats,
            lon=overall_lons
        )
    
        # Update traces with custom data and styling
        fig_trck.update_traces(
            customdata=customdata,
            hovertemplate=hovertemplate,
            marker_size=3,
            marker_color=overall_focus,
            marker_colorscale='Rainbow',
            marker_showscale=False,
            line_width=2,
            line_color='Blue',
            mode=mode
        )

When I use Plotly 5.24.1 it gives this result in the DOM:
Object
points:Array(1)
0:
bbox:{x0: 894.0113118377704, x1: 896.0113118377704, y0: 354.0555201566335, y1: 356.0555201566335}
curveNumber: 0
customdata :( 4) [33519.2, 22.104, 4.507961, 51.843206]
lat:51.843206
lon:4.507961
pointIndex:4327
pointNumber:4327
[[Prototype]]:Object

when I use Plotly 6.0.0, I get this result:
Object
points : Array(1)
0:
bbox: {x0: 894.0113118377704, x1: 896.0113118377704, y0: 354.0555201566335, y1: 356.0555201566335}
curveNumber:0
customdata : undefined
lat:51.843206
lon:4.507961
pointIndex:4327
pointNumber:4327
[[Prototype]]: Object
length: 1

Can anyone explain this? Is it a bug or is customdata removed to another position in the DOM?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1needed for current cyclebugsomething brokenregressionthis used to work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions