Skip to content

Identification of selected points with a key #1765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
monfera opened this issue Jun 7, 2017 · 3 comments
Closed

Identification of selected points with a key #1765

monfera opened this issue Jun 7, 2017 · 3 comments
Assignees
Labels
feature something new

Comments

@monfera
Copy link
Contributor

monfera commented Jun 7, 2017

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.

@monfera monfera self-assigned this Jun 7, 2017
@etpinard
Copy link
Contributor

etpinard commented Jun 7, 2017

eventData itself has an id field but it's undefined

for the unique identification of a data point

That what ids is for, added in @rreusser 's #802

See https://codepen.io/etpinard/pen/PjPWpj?editors=0010

@monfera
Copy link
Contributor Author

monfera commented Jun 7, 2017

fantastic, thanks!

@etpinard etpinard closed this as completed Jun 8, 2017
@monfera
Copy link
Contributor Author

monfera commented Jun 10, 2017

... I saw the id in the event data but attr is plural which I missed, would it be useful to rename at some point? Usually even array attribs are singular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

No branches or pull requests

2 participants