Description
When lassoing, the current way to get the selected points is to do something like
eventData
? eventData.points.map(({curveNumber, pointNumber}) => gd.calcdata[curveNumber][pointNumber])
: null
- eventData itself has an
id
field but it'sundefined
(am I missing some relevant use?) and, currently, thedata
property of thecalcdata
leaf can carry anything via thecustomdata
attribute when callingPlotly.plotNew
.
As customdata
is an attribute intended for library users, I think we should have a separate attribute, e.g. key
, for the unique identification of a data point, to let crossfiltering have sufficient selection input. The identification must be unique enough to identify a record of a 'dataframe' that the plot feeds from. It can't trivially be an index number of the data.x
/data.y
because a specific plot may not have all the rows to render (consider a set of trellised panels, each plotting just a subset of the data). From the viewpoint of plotly.js
the key
field is populated by the API caller and the doc clearly states its intended use.
Any alternative ideas or already available mechanism?
When using the box selector, the situation is easier because of receiving a simple x
/y
data domain. The points are also available so the use of the x
/y
domain is more of a special-case optimization opportunity so this item considers the more general case of the lasso.