From aad677e9be6e1967d3db9a3d93aac963c68644f0 Mon Sep 17 00:00:00 2001 From: Marc Gauch <34353267+marcgauch@users.noreply.github.com> Date: Fri, 12 May 2023 15:12:05 +0200 Subject: [PATCH] FIXED: DRY --- dashboard2/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dashboard2/main.py b/dashboard2/main.py index 145fd01..1e003b8 100644 --- a/dashboard2/main.py +++ b/dashboard2/main.py @@ -12,6 +12,8 @@ app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP]) df = pd.DataFrame({'y': np.random.normal(loc=0, scale=10, size=1000), 'x': np.random.normal(loc=10, scale=2, size=1000)}) +df_min = math.floor(df["y"].min()) +df_max = math.ceil(df["y"].max()) app.layout = html.Div( [ @@ -32,9 +34,9 @@ app.layout = html.Div( dbc.Col( [ dcc.RangeSlider( - min=math.floor(df["y"].min()), - max=math.ceil(df["y"].max()), - value=[math.floor(df["y"].min()), math.ceil(df["y"].max())], + min=df_min, + max=df_max, + value=[df_min, df_max], id="range", ) ],