I had set a callback that receives the value of a dropdown and a clickdata on a graph. If dropdown value changes, the graph was recolored and table values were updated. If I click on the graph, the same thing happens with the colors and the table Data. But there’s this situation: When I already clicked on the graph the clickdata haven’t been cleaned. So, how can I know the origin of the callback or how can i clean the clickdata on the end of the current callback?
I’m using the dcc.Graph figure (plotly figure type=choroplethmapbox) ‘clickData’ input to highlight the area of the map clicked on. The first click works fine. But clicking again on the same area is supposed to “deselect” that area. But I don’t get another clickData event because of course that property hasn’t changed for the figure.
What should be the pattern to detect a second click on the same map area?
What I did to resolve this was to create a layer above the base map for “selections”. The selection layer paints the same data/color for the polygons but outlines them in a highlight color. Since that layer establishes a new identity for the area under that region, so clicking again is delivered as a new event to a new figure layer.
I have yet to investigate whether there is built-in “selection” capability I can exploit on choropleth-mapbox.