Skip to content

Identification of selected points with a key #1765

Closed
@monfera

Description

@monfera

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's undefined (am I missing some relevant use?) and, currently, the data property of the calcdata leaf can carry anything via the customdata attribute when calling Plotly.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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions