Skip to content

Commit ee9ea8c

Browse files
committed
some experimental changes to try to get it working at the trace level (does not work yet)
1 parent 1126715 commit ee9ea8c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/components/fx/calc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = function calc(gd) {
4040
fillFn(trace.hoverlabel.font.variant, cd, 'htv');
4141
fillFn(trace.hoverlabel.namelength, cd, 'hnl');
4242
fillFn(trace.hoverlabel.align, cd, 'hta');
43+
fillFn(trace.hoverlabel.showarrow, cd, 'hsa');
4344
}
4445
};
4546

src/components/fx/hover.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
913913

914914
if(!helpers.isUnifiedHover(hovermode)) {
915915
hoverAvoidOverlaps(hoverLabels, rotateLabels, fullLayout, hoverText.commonLabelBoundingBox);
916-
alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY, fullLayout.hoverlabel.showarrow);
916+
alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
917917
} // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
918918
// we should improve the "fx" API so other plots can use it without these hack.
919919
if(eventTarget && eventTarget.tagName) {
@@ -1903,7 +1903,7 @@ function getTextShiftX(hoverLabel) {
19031903
};
19041904
}
19051905

1906-
function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY, showArrow) {
1906+
function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) {
19071907
var pX = function(x) { return x * scaleX; };
19081908
var pY = function(y) { return y * scaleY; };
19091909

@@ -1928,7 +1928,7 @@ function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY, showArrow) {
19281928
// middle aligned: rect centered on data
19291929
pathStr = 'M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) +
19301930
'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z';
1931-
} else if(showArrow !== false) {
1931+
} else if(d.showarrow !== false) {
19321932
// left or right aligned: side rect with arrow to data
19331933
pathStr = 'M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) +
19341934
'v' + pY(d.by / 2 - HOVERARROWSIZE) +
@@ -2013,6 +2013,7 @@ function cleanPoint(d, hovermode) {
20132013
fill('fontVariant', 'htv', 'hoverlabel.font.variant');
20142014
fill('nameLength', 'hnl', 'hoverlabel.namelength');
20152015
fill('textAlign', 'hta', 'hoverlabel.align');
2016+
fill('showarrow', 'hsa', 'hoverlabel.showarrow');
20162017

20172018
d.posref = (hovermode === 'y' || (hovermode === 'closest' && trace.orientation === 'h')) ?
20182019
(d.xa._offset + (d.x0 + d.x1) / 2) :

0 commit comments

Comments
 (0)