Skip to content

Commit 7157b54

Browse files
Fixed hover behaviour for multicategory plots
1 parent 35fb5b9 commit 7157b54

File tree

2 files changed

+1632
-1
lines changed

2 files changed

+1632
-1
lines changed

src/components/fx/hover.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,16 @@ function createHoverText(hoverData, opts) {
889889
var ya = c0.ya;
890890
var axLetter = hovermode.charAt(0);
891891
var t0 = c0[axLetter + 'Label'];
892+
893+
// search in array for the label
894+
if(!t0) {
895+
hoverData.map(function(data) {
896+
if(data[axLetter + 'Label']) {
897+
t0 = data[axLetter + 'Label'];
898+
}
899+
});
900+
}
901+
892902
var outerContainerBB = getBoundingClientRect(gd, outerContainer);
893903
var outerTop = outerContainerBB.top;
894904
var outerWidth = outerContainerBB.width;
@@ -2067,7 +2077,7 @@ function getCoord(axLetter, winningPoint, fullLayout) {
20672077

20682078
var cd0 = winningPoint.cd[0];
20692079

2070-
if(ax.type === 'category') val = ax._categoriesMap[val];
2080+
if(ax.type === 'category' || ax.type === 'multicategory') val = ax._categoriesMap[val];
20712081
else if(ax.type === 'date') {
20722082
var periodalignment = winningPoint.trace[axLetter + 'periodalignment'];
20732083
if(periodalignment) {

0 commit comments

Comments
 (0)