You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Select a set of points using lasso or rectangular selection
Deselect points by double-clicking elsewhere in the plot
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.
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.
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.
@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/
Activity
chriddyp commentedon Jul 24, 2017
Seems like this is a bug 👍 . Thanks for reporting! Will work on a fix this week.
chriddyp commentedon Jul 24, 2017
@pmbaumgartner - Returning
or
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 commentedon Jul 24, 2017
It looks like plotly.js doesn't distinguish between "single-click" and "double-click to remove selection box" in the
selectedevent. We'll needplotly.jsto update this event data before we patch this.chriddyp commentedon Jul 24, 2017
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
Nonemakes 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 commentedon 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:orif selectedData is None:would be returningNone. (ex),The other pattern is
if (selectedData or len(selectedData['points']) == 0):which would be consistent with returningpoints: [](ex)Clear the selectedData if the selection box was cleared\nThis partially
chriddyp commentedon Jul 24, 2017
Fix here: plotly/dash-core-components#40
chriddyp commentedon Jul 24, 2017
Fixed! see plotly/dash-core-components#40. Upgrade with
pip install dash-core-components==0.7.1pmbaumgartner commentedon Jul 24, 2017
@chriddyp not sure if this is related to the change, but I'm getting
Error loading dependenciesorError loading layouton my app after the upgrade. It's also happening with the docs @ https://plot.ly/dash/pmbaumgartner commentedon Jul 24, 2017
Guessing the CDN needs to be updated?
chriddyp commentedon Jul 24, 2017
Yeah, forgot to update the CDN 🤦♂️ Updated now, should be good to go. Thanks for reporting!
Clear the selectedData if the selection box was cleared\nThis partially
generate html after template change (plotly#97)
generate html after template change (plotly#97)
generate html after template change (#97)