Skip to content

Commit 040208f

Browse files
committed
do not coerce hoverinfo if hovertemplate is defined
1 parent d263cce commit 040208f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/plots/plots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
11671167

11681168
if(_module) {
11691169
_module.supplyDefaults(traceIn, traceOut, defaultColor, layout);
1170-
Lib.coerceHoverinfo(traceIn, traceOut, layout);
1170+
if(!traceOut.hovertemplate) Lib.coerceHoverinfo(traceIn, traceOut, layout);
11711171
}
11721172

11731173
coerce('hovertemplate');

test/jasmine/tests/plots_test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ describe('Test Plots', function() {
251251
traceOut = supplyTraceDefaults(traceIn, {type: 'scatter'}, 0, layout);
252252
expect(traceOut.hoverinfo).toEqual('name');
253253
});
254+
255+
it('only if hovertemplate is not defined', function() {
256+
layout._dataLength = 1;
257+
258+
traceIn = {};
259+
traceOut = supplyTraceDefaults(traceIn, {type: 'scatter', hovertemplate: '%{y}'}, 0, layout);
260+
expect(traceOut.hoverinfo).toBeUndefined();
261+
});
254262
});
255263
});
256264

0 commit comments

Comments
 (0)