Skip to content

Commit 27d1e12

Browse files
committed
add early eject for no labels to be drawn
1 parent ccd86f0 commit 27d1e12

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/fx/hover.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,13 +819,15 @@ function createHoverText(allHoverData, opts, gd) {
819819
var container = opts.container;
820820
var outerContainer = opts.outerContainer;
821821
var commonLabelOpts = opts.commonLabelOpts || {};
822+
// Early exit if no labels are drawn
823+
if(hoverData.length === 0) return container.selectAll('g.hovertext');
822824

823825
// opts.fontFamily/Size are used for the common label
824826
// and as defaults for each hover label, though the individual labels
825827
// can override this.
826828
var fontFamily = opts.fontFamily || constants.HOVERFONT;
827829
var fontSize = opts.fontSize || constants.HOVERFONTSIZE;
828-
830+
829831
var c0 = hoverData[0];
830832
var xa = c0.xa;
831833
var ya = c0.ya;

0 commit comments

Comments
 (0)