1313
1414__author__ = "Jonas Van Der Donckt"
1515
16- import dash
1716import dash_bootstrap_components as dbc
1817import plotly .graph_objects as go
1918from pathlib import Path
2019from typing import List
21- from dash import Input , Output , State , dcc , html
20+ from dash import Input , Output , State , dcc , html , no_update , callback_context
2221
2322from dash_extensions .enrich import (
2423 DashProxy ,
@@ -132,7 +131,7 @@ def construct_plot_graph(n_clicks, *folder_list):
132131 for file in files :
133132 file_list .append ((Path (folder ).joinpath (file )))
134133
135- ctx = dash . callback_context
134+ ctx = callback_context
136135 if len (ctx .triggered ) and "plot-button" in ctx .triggered [0 ]["prop_id" ]:
137136 if len (file_list ):
138137 # Create two graphs, a dynamic plotly-resampler graph and a coarse graph
@@ -159,7 +158,7 @@ def construct_plot_graph(n_clicks, *folder_list):
159158
160159 return coarse_fig , dynamic_fig , dynamic_fig
161160 else :
162- raise dash . exceptions . PreventUpdate ()
161+ return no_update
163162
164163
165164# Register the graph update callbacks to the layout
@@ -172,17 +171,17 @@ def construct_plot_graph(n_clicks, *folder_list):
172171)
173172def update_dynamic_fig (coarse_grained_relayout , fine_grained_relayout , fr_fig ):
174173 if fr_fig is None : # When the figure does not exist -> do nothing
175- return dash . no_update
174+ return no_update
176175
177- ctx = dash . callback_context
176+ ctx = callback_context
178177 trigger_id = ctx .triggered [0 ].get ("prop_id" , "" ).split ("." )[0 ]
179178
180179 if trigger_id == "plotly-resampler-graph" :
181180 return fr_fig .construct_update_data (fine_grained_relayout )
182181 elif trigger_id == "coarse-graph" :
183182 return fr_fig .construct_update_data (coarse_grained_relayout )
184183
185- return dash . no_update
184+ return no_update
186185
187186
188187# --------------------------------- Running the app ---------------------------------
0 commit comments