Skip to content

Ensure winning points of hover are listed first when hoversubplots is set to "axis" and sorting by distance #6963

Merged
archmoj merged 5 commits intomasterfrom
fix6960-hoversubplots
Apr 15, 2024
Merged

Ensure winning points of hover are listed first when hoversubplots is set to "axis" and sorting by distance #6963
archmoj merged 5 commits intomasterfrom
fix6960-hoversubplots

Conversation

@archmoj
Copy link
Copy Markdown
Contributor

@archmoj archmoj commented Apr 12, 2024

Fixes #6960.

@plotly/plotly_js

@archmoj archmoj added bug something broken status: reviewable labels Apr 12, 2024
@archmoj archmoj requested a review from emilykl April 12, 2024 20:43
archmoj added 2 commits April 12, 2024 17:31
 - resolved conflicts in test/jasmine/tests/hover_label_test.js
@@ -700,9 +713,23 @@ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
gd._spikepoints = newspikepoints;

var sortHoverData = function() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@archmoj Could you add a comment here explaining the new sorting logic?

Copy link
Copy Markdown
Contributor

@emilykl emilykl left a comment

Choose a reason for hiding this comment

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

LGTM! 💃 Shows the correct behavior when testing Liam's codepen with your changes.

Screen Shot 2024-04-15 at 1 49 12 PM
Screen Shot 2024-04-15 at 1 49 49 PM

@archmoj archmoj merged commit 3b9de53 into master Apr 15, 2024
@archmoj archmoj deleted the fix6960-hoversubplots branch April 15, 2024 18:09
// When sorting keep the points in the main subplot at the top
// then add points in other subplots

var hoverDataInSubplot = hoverData.filter(function(a) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

naming suggestion -- should these functions be called hoverDataInMainSubplot and hoverDataNotInMainSubplot then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hoversubplots="axis" with hovermode="x" on stacked traces, shows x-axis label on first trace

2 participants