I am using a a px.choropleth_mapbox to draw state county outlines so users can select counties to filter their data using the box or lasso select options. This works well and I can get the locations from the selection tool and generate a list of selected counties. But I can’t figure out how to unselect and revert to all. How can I force either an unselect or (barring that) a refresh of the entire figure in order to reset to default conditions.
Hi @lpearson if you double-click outside of the selection this triggers a
selectedData event with
selectedData=null. You can check that the selection is cleared when double-clicking in https://plotly.com/python/mapbox-county-choropleth/#choropleth-map-using-plotlyexpress-and-carto-base-map-no-token-needed
HI Emmanuelle -
Thank you. It appears there is some sensitivity to an element of the double click that I can’t figure out. Such that it always works when i double tap using a touch screen, but is fairly hit-or-miss when double clicking with my mouse. Sometimes it clears on the first try, and sometimes it requires 2-4 double clicks before one works. This is for double clicking outside the choropleth area (ie in an area of the map without shapes.) It always works to clear the box selection by clicking on an individual shape and then clicking on it again to clear.
Exploring a little, I think maybe it is a reflex question - i.e. that frequently I don’t get the second click completed in whatever the time frame is to trigger the event as a double click. Do you know what the timing window in Dash is for double clicks?
And thanks again for the help! Knowing the double click was in fact supposed to work was the information I needed to repeatedly try it versus just giving up when it didn’t work the first time.
Oh yes the double-click delay is very short. You can change this parameter in the
config attribute of
dcc.Graph, see https://plotly.com/python/configuration-options/#doubleclick-delay (it’s the same
config syntax for
Thank you! Problem solved.
@Emmanuelle - is there a way to adjust this configuration setting at the app level vs just at an individual figure level? Now that I realize what is happening I realize it causes me issue everywhere (double clicking to isolate a trace, etc.) I really need to adjust it globally.