Skip to content

Commit d0516dc

Browse files
committed
Add pointNumbers support in pointsToKeys(); closes #1218
1 parent a60510e commit d0516dc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

NEWS.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
## BUG FIXES
1515

16+
* Bug fix for linking views with crosstalk where the source of the selection is an aggregated trace (see #1218).
1617
* Fixed algorithm for coercing the proposed layout to the plot schema (see #1156).
1718
* grid conversions in `ggplotly()` weren't respected a specified `height`/`width` in RStudio (see #1190).
1819

inst/htmlwidgets/plotly.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ HTMLWidgets.widget({
309309
// selecting a point of a "simple" trace means: select the
310310
// entire key attached to this trace, which is useful for,
311311
// say clicking on a fitted line to select corresponding observations
312-
var key = trace._isSimpleKey ? trace.key : trace.key[points[i].pointNumber];
312+
var pts = points[i].pointNumber || points[i].pointNumbers;
313+
var key = trace._isSimpleKey ? trace.key : Array.isArray(pts) ? pts.map(function(idx) { return trace.key[idx]; }) : trace.key[pts];
313314
// http://stackoverflow.com/questions/10865025/merge-flatten-an-array-of-arrays-in-javascript
314315
var keyFlat = trace._isNestedKey ? [].concat.apply([], key) : key;
315316

0 commit comments

Comments
 (0)