ADDED: A bit of comments for a reader

main
Marc Gauch 2023-05-12 15:48:53 +02:00
parent 95e6e86cd5
commit 6367cc0b76
1 changed files with 3 additions and 0 deletions

View File

@ -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()