Skip to content

Commit 81caeeb

Browse files
committed
handle the 3 cases separately
1 parent 8056cc5 commit 81caeeb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

inst/htmlwidgets/plotly.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,12 @@ HTMLWidgets.widget({
263263
for (var i = 0; i < attrsToAttach.length; i++) {
264264
var attr = trace[attrsToAttach[i]];
265265
if (Array.isArray(attr)) {
266-
var ptNums = pt.pointNumber || pt.pointNumbers;
267-
if (typeof ptNums === "number") {
268-
obj[attrsToAttach[i]] = ptNums;
269-
} else if (Array.isArray(ptNums)) {
270-
obj[attrsToAttach[i]] = ptNums.map(function(i) { return attr[i]; });
266+
if (typeof pt.pointNumber === "number") {
267+
obj[attrsToAttach[i]] = attr[pt.pointNumber];
268+
} else if (Array.isArray(pt.pointNumber)) {
269+
obj[attrsToAttach[i]] = attr[pt.pointNumber[0]][pt.pointNumber[1]];
270+
} else if (Array.isArray(pt.pointNumbers)) {
271+
obj[attrsToAttach[i]] = pt.pointNumbers.map(function(i) { return attr[i]; });
271272
}
272273
}
273274
}

0 commit comments

Comments
 (0)