Updating a go.choropleth selectedData dynamically

Hi guys.

I’m new on this forum so forgive me if I ask something on a wrong way.

I’m using Python and I’'ve built a dashboard where I have two horizontal barplots on the left and a choropleth map on the right. Each bar displays some information about a certain country.

Below them I have a slider that updates all the graphs according to the year selected.

I just have one callback with multiple inputs and outputs. One Output for each one of the 3 graphs and one Input to the slider and another to the bar hoverData (I couldn’t make it work with just one of the barplots hoverData yet, so I din’t even include another Input for the second barplot yet either).

What I’m trying to do is an interaction between the barplots and the choropleth where the map’s selectedData is updated as I hover over the corresponding country’s barplot’s bar, and as I hover out of any bar the map’s selectedData is reset.

Do I have to make multiple callbacks? Do I have to use some sort of Satate there? I’m kind of new on this dashboard building world, could you give me some enlightenment of the path I have to go to do this?

Hi @Bruno_mga,

I believe you can use the same approach as described here for hoverData, but instead use selectedData from the map as output. It should be a different callback than the first one, as you are not updating the figure property.

That said, I imagine you will run in some problems regarding the mouseout (hover out) event, since hoverData gets updated only when a new portion of the trace (a bar in your case) is selected. I know that for clickData there is a workaround described in this issue on how to reset the selection after the callback is fired up… but for hoverData it might be trickier.