Skip to content

fix: Populate xval/yval from calcdata when array-mode selection uses pointNumber - #7882

Merged
camdecoster merged 6 commits into
masterfrom
cam/7702/fix-missing-hover-xval-yval-map-geo-traces
Jun 30, 2026
Merged

fix: Populate xval/yval from calcdata when array-mode selection uses pointNumber#7882
camdecoster merged 6 commits into
masterfrom
cam/7702/fix-missing-hover-xval-yval-map-geo-traces

Conversation

@camdecoster

@camdecoster camdecoster commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Description

Populate xval/yval from calcdata when array-mode selection uses pointNumber. This happens in some map and geo traces.

Closes #7702.

Changes

  • Assign values to xval/yval in array-mode > pointNumber hover branch
  • Add test
  • Linting/formatting

Testing

  • Be on master
  • Run the following code snippet in Plotly devtools browser console
    Plotly.newPlot(gd, [{
        type: 'scattermap',
        lon: [-74, -118, -87],
        lat: [40, 34, 41],
        mode: 'markers'
    }], {
        map: { center: { lon: -97, lat: 40 }, zoom: 2 },
        width: 800,
        height: 500
    }).then(() => {
        Plotly.Fx.hover(gd, [{ curveNumber: 0, pointNumber: 0 }], "map");
    });
  • Note the error that shows up in the console
  • Switch to this branch
  • Run the snippet again
  • Note that the tooltip shows up in the plot without an error

Notes

  • This error occurred because there was a branch of the logic that handles array mode that didn't populate xval/yval
  • The call to hoverPoints still passed these undefined variables and caused an error for some map/geo traces
  • This fix adds those values, but it's a bit of band-aid with a check on the lonlat key. In the future, we might need to add per-trace accessors to get the proper values and make this check schema knowledge-independent
@camdecoster
camdecoster marked this pull request as ready for review June 30, 2026 22:25

@KoolADE85 KoolADE85 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described 💃

@camdecoster
camdecoster merged commit 34355d5 into master Jun 30, 2026
85 checks passed
@camdecoster
camdecoster deleted the cam/7702/fix-missing-hover-xval-yval-map-geo-traces branch June 30, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants