Skip to content

Commit 648547f

Browse files
committed
🔪 hoveron in scattergl
- hoveron was added *just* to make scatter/hover.js not break, it's functionality was never implemented in scattergl.
1 parent 1c61a47 commit 648547f

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

src/traces/scatter/hover.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
2424
ya = pointData.ya,
2525
xpx = xa.c2p(xval),
2626
ypx = ya.c2p(yval),
27-
pt = [xpx, ypx];
27+
pt = [xpx, ypx],
28+
hoveron = trace.hoveron || '';
2829

2930
// look for points to hover on first, then take fills only if we
3031
// didn't find a point
31-
if(trace.hoveron.indexOf('points') !== -1) {
32+
if(hoveron.indexOf('points') !== -1) {
3233
var dx = function(di) {
3334
// scatter points: d.mrc is the calculated marker radius
3435
// adjust the distance so if you're inside the marker it
@@ -84,7 +85,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
8485
}
8586

8687
// even if hoveron is 'fills', only use it if we have polygons too
87-
if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) {
88+
if(hoveron.indexOf('fills') !== -1 && trace._polygons) {
8889
var polygons = trace._polygons,
8990
polygonsIn = [],
9091
inside = false,

src/traces/scattergl/attributes.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,5 @@ module.exports = {
8484
fillcolor: scatterAttrs.fillcolor,
8585

8686
error_y: scatterAttrs.error_y,
87-
error_x: scatterAttrs.error_x,
88-
89-
hoveron: {
90-
valType: 'flaglist',
91-
flags: ['points', 'fills'],
92-
role: 'info',
93-
description: [
94-
'Do the hover effects highlight individual points (markers or',
95-
'line points) or do they highlight filled regions?',
96-
'If the fill is *toself* or *tonext* and there are no markers',
97-
'or text, then the default is *fills*, otherwise it is *points*.'
98-
].join(' ')
99-
}
87+
error_x: scatterAttrs.error_x
10088
};

src/traces/scattergl/defaults.js

-11
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
5050
handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);
5151
}
5252

53-
var dfltHoverOn = [];
54-
55-
if(subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) {
56-
dfltHoverOn.push('points');
57-
}
58-
if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') {
59-
dfltHoverOn.push('fills');
60-
}
61-
62-
coerce('hoveron', dfltHoverOn.join('+') || 'points');
63-
6453
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y'});
6554
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'});
6655
};

0 commit comments

Comments
 (0)