Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customdata missing in hoverdata in Ploly 6.0.0 #7375

Open
Hermeij opened this issue Feb 22, 2025 · 2 comments
Open

Customdata missing in hoverdata in Ploly 6.0.0 #7375

Hermeij opened this issue Feb 22, 2025 · 2 comments
Labels
bug something broken P2 considered for next cycle

Comments

@Hermeij
Copy link

Hermeij commented Feb 22, 2025

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?

@dgibbon-plotly
Copy link

@Hermeij I can't help you with this question technically ... but I AM super intrigued wrt what you're looking to display -> specifically "cycling track and several graphs to show distance vs. speed, distance vs. power etc." ... Do you have any screenshots, animated gifs, video of that??

@Hermeij
Copy link
Author

Hermeij commented Feb 23, 2025

@dgibbon-plotly
Here is a link to a video I made for you:
https://1drv.ms/v/s!AuWRFk9aKH8Oi-QsAyQoccIL_PgWBA?e=WKaSVw

@gvwilson gvwilson added bug something broken P2 considered for next cycle labels Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P2 considered for next cycle
Projects
None yet
Development

No branches or pull requests

3 participants