Skip to content
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

selectedData does not update on deselection #97

Closed
pmbaumgartner opened this issue Jul 24, 2017 · 10 comments

Comments

Projects
None yet
2 participants
@pmbaumgartner
Copy link

commented Jul 24, 2017

selectedData does not update when data that is selected through the lasso or rectangular selection tool is deselected. You can view this behavior from the crossfiltering example in the docs: https://plot.ly/dash/getting-started-part-2#basic-interactions

This has an impact on building dashboards that use crossfiltering to summarize information for a set of points. For example, I have a chart that by default aggregates information for all points in a scatterplot if selectedData is empty. Once selectedData is not empty, the aggregating charts then summarize info for the selected data. If I deselect points, I want the charts to return to aggregating for all data points. Currently, in order to get this behavior, I would have to reselect all points in the plot with the select tools.

Replication:

  1. Select a set of points using lasso or rectangular selection
  2. Deselect points by double-clicking elsewhere in the plot

data-deselect


I have also asked on the community forums if this is the expected behavior.

@chriddyp

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

Seems like this is a bug 👍 . Thanks for reporting! Will work on a fix this week.

@chriddyp chriddyp added the Type: Bug label Jul 24, 2017

@chriddyp

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

@pmbaumgartner - Returning

{
    "points": []
}

or

None

I think that points: [] makes more sense here. However, it will be impossible to distinguish between the "unselect" case and the "selected no points" case.

@chriddyp

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

It looks like plotly.js doesn't distinguish between "single-click" and "double-click to remove selection box" in the selected event. We'll need plotly.js to update this event data before we patch this.

@chriddyp

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

I think that points: [] makes more sense here.

Actually, I don't think this makes sense. The Dash developer needs to know if there is a persistent selection box or not. If there is a persistent selection box but no data, then the data structure will be {points: []}. However, if there is no selection box then the developer needs to know that so they can e.g. redraw all of the original points.

Maybe reset to None makes the most sense here then. That's the initial value when there is no selection box.

This is actually sort of related to plotly/plotly.js#1848

@pmbaumgartner

This comment has been minimized.

Copy link
Author

commented Jul 24, 2017

re: return value - I think it depends on what you want the pattern to be for when data is selected to crossfilter.

A change that would be consistent with the pattern of if selectedData: or if selectedData is None: would be returning None. (ex),

The other pattern is if (selectedData or len(selectedData['points']) == 0): which would be consistent with returning points: [] (ex)

chriddyp added a commit to plotly/dash-core-components that referenced this issue Jul 24, 2017

@chriddyp

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

@chriddyp

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

Fixed! see plotly/dash-core-components#40. Upgrade with pip install dash-core-components==0.7.1

@pmbaumgartner

This comment has been minimized.

Copy link
Author

commented Jul 24, 2017

@chriddyp not sure if this is related to the change, but I'm getting Error loading dependencies or Error loading layout on my app after the upgrade. It's also happening with the docs @ https://plot.ly/dash/

screen shot 2017-07-24 at 6 12 07 pm

@pmbaumgartner

This comment has been minimized.

Copy link
Author

commented Jul 24, 2017

Guessing the CDN needs to be updated?

screen shot 2017-07-24 at 6 24 36 pm

@chriddyp

This comment has been minimized.

Copy link
Member

commented Jul 24, 2017

Yeah, forgot to update the CDN 🤦‍♂ Updated now, should be good to go. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.