Skip to content

Commit 959a555

Browse files
committed
add & 🔒 hovertext support for scattergl
1 parent bdc8f4a commit 959a555

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/traces/scattergl/attributes.js

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ var attrs = module.exports = overrideAll({
3737
'this trace\'s (x,y) coordinates.'
3838
].join(' ')
3939
}),
40-
4140
hovertext: scatterAttrs.hovertext,
4241

4342
textposition: scatterAttrs.textposition,

src/traces/scattergl/defaults.js

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3636
var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines';
3737

3838
coerce('text');
39+
coerce('hovertext');
3940
coerce('mode', defaultMode);
4041

4142
if(subTypes.hasLines(traceOut)) {

test/jasmine/tests/gl2d_click_test.js

+27
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,33 @@ describe('@gl @flaky Test hover and click interactions', function() {
318318
.then(done);
319319
});
320320

321+
it('should show correct label for scattergl when hovertext is set', function(done) {
322+
var _mock = Lib.extendDeep({}, mock1);
323+
_mock.data[0].hovertext = 'text';
324+
_mock.data[0].hovertext = 'HoVeRtExT';
325+
_mock.layout.hovermode = 'closest';
326+
327+
var run = makeRunner([634, 321], {
328+
x: 15.772,
329+
y: 0.387,
330+
label: ['(15.772, 0.387)\nHoVeRtExT', null],
331+
curveNumber: 0,
332+
pointNumber: 33,
333+
bgcolor: 'rgb(0, 0, 238)',
334+
bordercolor: 'rgb(255, 255, 255)',
335+
fontSize: 13,
336+
fontFamily: 'Arial',
337+
fontColor: 'rgb(255, 255, 255)'
338+
}, {
339+
msg: 'scattergl with hovertext'
340+
});
341+
342+
Plotly.plot(gd, _mock)
343+
.then(run)
344+
.catch(failTest)
345+
.then(done);
346+
});
347+
321348
it('should output correct event data for pointcloud', function(done) {
322349
var _mock = Lib.extendDeep({}, mock2);
323350

0 commit comments

Comments
 (0)