diff --git a/dashboard/app.py b/dashboard/app.py index aa114de..487e42c 100644 --- a/dashboard/app.py +++ b/dashboard/app.py @@ -199,25 +199,15 @@ def update_gauge_hist_pie(date_range, clickData): return gauge_chart_toxitolerance, gauge_chart_eutrophication, gauge_chart_acidity, hist3_species, pie_thallus @callback( - Output(component_id='map-species_present', component_property='figure'), - Output(component_id='hist4-species', component_property='figure'), - Output(component_id='species-name', component_property='children'), - Output(component_id='species-image', component_property='src'), - Output(component_id='acid-badge', component_property='children'), - Output(component_id='eutro-badge', component_property='children'), - Output(component_id='toxitolerance-badge', component_property='children'), - Output(component_id='species-thallus', component_property='children'), - Output(component_id='species-rarity', component_property='children'), - Input(component_id='species-dropdown', component_property='value'), + Output('map-species_present', 'figure'), + Input('species-dropdown', 'value'), Input('map-species-style-dropdown', 'value'), State('map-species_present', 'relayoutData') ) -def update_dashboard2(species_id_selected, map_style, relayoutData): +def update_map(species_id_selected, map_style, relayoutData): if isinstance(species_id_selected, str): species_id_selected = int(species_id_selected) - hist4_species = create_hist4(nb_lichen_per_species_df, species_id_selected, lang=lang) - observation_with_selected_species_col_df['selected_species_present'] = observation_df['observation_id'].isin( lichen_df.loc[lichen_df['species_id'] == species_id_selected, 'observation_id'] ) @@ -231,6 +221,26 @@ def update_dashboard2(species_id_selected, map_style, relayoutData): fig_map = create_map_species_present(observation_with_selected_species_col_df, 'selected_species_present', current_zoom, current_center, map_style, lang=lang) + return fig_map + + +@callback( + Output('hist4-species', 'figure'), + Output('species-name', 'children'), + Output('species-image', 'src'), + Output('acid-badge', 'children'), + Output('eutro-badge', 'children'), + Output('toxitolerance-badge', 'children'), + Output('species-thallus', 'children'), + Output('species-rarity', 'children'), + Input('species-dropdown', 'value') +) +def update_species_info(species_id_selected): + if isinstance(species_id_selected, str): + species_id_selected = int(species_id_selected) + + hist4_species = create_hist4(nb_lichen_per_species_df, species_id_selected, lang=lang) + species_selected = merged_lichen_species_df[merged_lichen_species_df['species_id'] == species_id_selected].iloc[0] species_name = species_selected['name'] @@ -243,7 +253,7 @@ def update_dashboard2(species_id_selected, map_style, relayoutData): species_thallus = get_translation(species_selected['thallus'], lang) species_rarity = get_translation(species_selected['rarity'], lang) - return fig_map, hist4_species, species_name, species_img_path, species_acidity, species_eutrophication, species_toxitolerance, species_thallus, species_rarity + return hist4_species, species_name, species_img_path, species_acidity, species_eutrophication, species_toxitolerance, species_thallus, species_rarity # Reusable components def title_and_tooltip(title, tooltip_text): @@ -297,8 +307,6 @@ def histogram_card(title, tooltip_text, graph_id, height='330px'): ) - - # Layout for the sites (observations) sites_layout = html.Div( style=FLEX_COLUMNS_CONTAINER_STYLE, diff --git a/dashboard/assets/locale/en.json b/dashboard/assets/locale/en.json index 9d8a072..fbbfcf5 100644 --- a/dashboard/assets/locale/en.json +++ b/dashboard/assets/locale/en.json @@ -77,5 +77,6 @@ "south": "south", "east": "east", "west": "west", - "count": "count" + "count": "count", + "indéterminé": "undefined" } diff --git a/dashboard/assets/locale/fr.json b/dashboard/assets/locale/fr.json index 2a3b724..17e7838 100644 --- a/dashboard/assets/locale/fr.json +++ b/dashboard/assets/locale/fr.json @@ -77,5 +77,6 @@ "south": "sud", "east": "est", "west": "ouest", - "count": "nombre" + "count": "nombre", + "indéterminé": "indéterminé" }