From 6367cc0b76ba9a31656ef3b5cd199c374d5531e3 Mon Sep 17 00:00:00 2001 From: Marc Gauch <34353267+marcgauch@users.noreply.github.com> Date: Fri, 12 May 2023 15:48:53 +0200 Subject: [PATCH] ADDED: A bit of comments for a reader --- dashboard2/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dashboard2/main.py b/dashboard2/main.py index fbde1d5..1aadbb8 100644 --- a/dashboard2/main.py +++ b/dashboard2/main.py @@ -53,9 +53,12 @@ app.layout = html.Div( ], className="m-4", ) + +# Now the color selecion and the slider works for both diagrams @app.callback(Output("graph_1", "figure"), Input("color", "value"), Input("range", "value")) def update_graph_1(color, range): + # this filter is used twice. This could be improved dff = df[(df['y'] > range[0]) & (df['y'] < range[1])] fig = px.histogram(dff, x="y", color_discrete_sequence=[color]) fig.update_layout()