✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Choroplethmapbox hover problem

I have a problem with hovering on Choroplethmapbox.
When I load the page for the first time, hovering works fine.
But when I use Dropdown or Slider (they changedata for the map), hovertext does not show up.

And when I was typing this, I tried to click “Reset view” and it helped! But is there any way to make it work without clicking this button?

And by the way, ‘reset view’ also helped with another issue: when I change dropdown/slider, data update commits only after second attempt (I have to click twice on slider point).

My callbacks:

# this one updates the slider after selecting value from the dropdown
    [Output('app7-survivalyear', 'marks'),
     Output('app7-survivalyear', 'max'),
     Output('app7-survivalyear', 'value')],
    [Input('app7-birthyear', 'value')]
def update_survivalyear(birthyear):
    temp_df = df.loc[(df['Year of birth'] == birthyear)]
    survivalyear_marks = dict()
    survival_years = temp_df['Survival year'].unique()
    for i, survival_year in enumerate(survival_years):
        survivalyear_marks[i] = survival_year
    survivalyear_max = len(survival_years) - 1
    print('marks', survivalyear_marks, 'surv max', survivalyear_max)
    return survivalyear_marks, survivalyear_max, 0

# this one filters data depending on the dropdown and the slider values
    Output('app7-map', 'figure'),
    [Input('app7-birthyear', 'value'),
     Input('app7-survivalyear', 'value')]
def update_options(birth_year, survival_year_index):
    temp_df = df.loc[(df['Year of birth'] == birth_year) & (df['id'] != 'BY')]
    survival_years = temp_df['Survival year'].unique()
    survival_year = survival_years[survival_year_index]
    temp_df = temp_df.loc[(df['Survival year'] == survival_year)]

    figure = go.Figure(go.Choroplethmapbox(geojson=geodata, locations=temp_df['id'], z=temp_df['Value'], reversescale=True,
                                           colorscale="Cividis", zauto=True,
                                           text=['Брестская область', 'Витебская область', 'Гомельская область',
                                                 'г. Минск', 'Гродненская область', 'Минская область',
                                                 'Могилевская область'],
                                           marker_opacity=0.5, marker_line_width=1))
                         mapbox_center={"lat": 53.8, "lon": 27.6},
                         margin={"r": 0, "t": 0, "l": 0, "b": 0},

    return figure


Well, I’ve found a kind of solution:
my map was wrapped in dcc.Loading,
and when I removed that Loading everything start working fine.

I’m stuck with the same problem… Did you find a better solution for it? dcc.Loading state is important in my app, since the map takes some time to load!

Yes, i think there is a probleme with dcc.Loading, i came across at least two topics dealing with same problem. as i said in this reply i think that there is an open issue on github and maybe the proposed solutions there may work, for me i just removed it for now.