Skip to content

Commit 689adfa

Browse files
committed
place period positioned points at the end to avoid winning hover
1 parent a5a5de9 commit 689adfa

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/components/fx/hover.js

+22
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,9 @@ function _hover(gd, evt, subplot, noHoverEvent) {
680680
});
681681
}
682682

683+
// move period positioned points to the end of list
684+
orderPeriod(hoverData, hovermode);
685+
683686
// lastly, emit custom hover/unhover events
684687
var oldhoverdata = gd._hoverdata;
685688
var newhoverdata = [];
@@ -1889,3 +1892,22 @@ function plainText(s, len) {
18891892
allowedTags: ['br', 'sub', 'sup', 'b', 'i', 'em']
18901893
});
18911894
}
1895+
1896+
function orderPeriod(hoverData, hovermode) {
1897+
var axLetter = hovermode.charAt(0);
1898+
1899+
var first = [];
1900+
var last = [];
1901+
1902+
for(var i = 0; i < hoverData.length; i++) {
1903+
var d = hoverData[i];
1904+
1905+
if(d.trace[axLetter + 'period']) {
1906+
last.push(d);
1907+
} else {
1908+
first.push(d);
1909+
}
1910+
}
1911+
1912+
hoverData = first.concat(last);
1913+
}

0 commit comments

Comments
 (0)