8000 Fixup hover on period positioned points by archmoj · Pull Request #5618 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Fixup hover on period positioned points #5618

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

Merged
merged 14 commits into from
May 13, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
place period positioned points at the end to avoid winning hover
  • Loading branch information
archmoj committed Apr 29, 2021
commit 689adfaad22d482ca5ff702c59625e17c4b708b9
22 changes: 22 additions & 0 deletions src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,9 @@ function _hover(gd, evt, subplot, noHoverEvent) {
});
}

// move period positioned points to the end of list
orderPeriod(hoverData, hovermode);

// lastly, emit custom hover/unhover events
var oldhoverdata = gd._hoverdata;
var newhoverdata = [];
Expand Down Expand Up @@ -1889,3 +1892,22 @@ function plainText(s, len) {
allowedTags: ['br', 'sub', 'sup', 'b', 'i', 'em']
});
}

function orderPeriod(hoverData, hovermode) {
var axLetter = hovermode.charAt(0);

var first = [];
var last = [];

for(var i = 0; i < hoverData.length; i++) {
var d = hoverData[i];

if(d.trace[axLetter + 'period']) {
last.push(d);
} else {
first.push(d);
}
}

hoverData = first.concat(last);
}
0