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 · Fixed by plotly/dash-core-components#40
Closed

selectedData does not update on deselection #97

pmbaumgartner opened this issue Jul 24, 2017 · 10 comments · Fixed by plotly/dash-core-components#40

Comments

@pmbaumgartner
Copy link

pmbaumgartner 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
Copy link
Member

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

@chriddyp chriddyp added the bug label Jul 24, 2017
@chriddyp
Copy link
Member

@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
Copy link
Member

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

chriddyp commented Jul 24, 2017

Fix here: plotly/dash-core-components#40

@chriddyp
Copy link
Member

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

@pmbaumgartner
Copy link
Author

pmbaumgartner 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
Copy link
Author

Guessing the CDN needs to be updated?

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

@chriddyp
Copy link
Member

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

HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 22, 2021
HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 22, 2021
HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 28, 2021
HammadTheOne pushed a commit that referenced this issue Jul 23, 2021
Companion to PR #96 -- forgot to regen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants