Skip to content

Commit 7c036ab

Browse files
committed
unified hoverlabel: only show spikelines if there are hoverPoints
1 parent 69ffbb1 commit 7c036ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/fx/hover.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
244244
}
245245

246246
var hovermode = evt.hovermode || fullLayout.hovermode;
247+
var spikeOnlyOnHover = ['x unified', 'y unified'].indexOf(hovermode) !== -1;
247248

248249
if(hovermode && !supportsCompare) hovermode = 'closest';
249250

@@ -504,7 +505,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
504505
// Now if there is range to look in, find the points to draw the spikelines
505506
// Do it only if there is no hoverData
506507
if(hasCartesian && (spikedistance !== 0)) {
507-
if(hoverData.length === 0) {
508+
if(hoverData.length === 0 && !spikeOnlyOnHover) {
508509
pointData.distance = spikedistance;
509510
pointData.index = false;
510511
var closestPoints = trace._module.hoverPoints(pointData, xval, yval, 'closest', fullLayout._hoverlayer);

0 commit comments

Comments
 (0)