Skip to content

Commit 7e55391

Browse files
author
John Soklaski
committed
Switch to use Array.isArray to check subplot argument. Cleanup to satisfy linting rules.
1 parent db44a5b commit 7e55391

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/plots/cartesian/graph_interact.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,12 @@ function hover(gd, evt, subplot){
314314
var fullLayout = gd._fullLayout,
315315
plotinfo = fullLayout._plots[subplot],
316316
//If the user passed in an array of subplots, use those instead of finding overlayed plots
317-
subplots = (Object.prototype.toString.call(subplot) == "[object Array]") ?
317+
subplots = Array.isArray(subplot) ?
318318
subplot :
319-
320-
subplots = [subplot].concat(plotinfo.overlays
319+
// list of all overlaid subplots to look at
320+
[subplot].concat(plotinfo.overlays
321321
.map(function(pi){ return pi.id; })),
322322

323-
// list of all overlaid subplots to look at
324-
325323
xaArray = subplots.map(function(spId) {
326324
return Plotly.Axes.getFromId(gd, spId, 'x');
327325
}),
@@ -539,7 +537,7 @@ function hover(gd, evt, subplot){
539537
};
540538
var hoverLabels = createHoverText(hoverData, labelOpts);
541539

542-
hoverAvoidOverlaps(hoverData, rotateLabels ? "xa" : "ya");
540+
hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya');
543541

544542
alignHoverText(hoverLabels, rotateLabels);
545543

@@ -1156,9 +1154,9 @@ function hoverAvoidOverlaps(hoverData, ax) {
11561154
p0 = g0[g0.length-1],
11571155
p1 = g1[0];
11581156
topOverlap = p0.pos+p0.dp+p0.size-p1.pos-p1.dp+p1.size;
1159-
1157+
11601158
//Only group points that lie on the same axes
1161-
if(topOverlap>0.01 && (p0.pmin == p1.pmin) && (p0.pmax == p1.pmax)) {
1159+
if(topOverlap>0.01 && (p0.pmin === p1.pmin) && (p0.pmax === p1.pmax)) {
11621160
// push the new point(s) added to this group out of the way
11631161
for(j=g1.length-1; j>=0; j--) g1[j].dp += topOverlap;
11641162

0 commit comments

Comments
 (0)