ADDED: A bit of comments for a reader
parent
95e6e86cd5
commit
6367cc0b76
|
@ -53,9 +53,12 @@ app.layout = html.Div(
|
||||||
],
|
],
|
||||||
className="m-4",
|
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"))
|
@app.callback(Output("graph_1", "figure"), Input("color", "value"), Input("range", "value"))
|
||||||
|
|
||||||
def update_graph_1(color, range):
|
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])]
|
dff = df[(df['y'] > range[0]) & (df['y'] < range[1])]
|
||||||
fig = px.histogram(dff, x="y", color_discrete_sequence=[color])
|
fig = px.histogram(dff, x="y", color_discrete_sequence=[color])
|
||||||
fig.update_layout()
|
fig.update_layout()
|
||||||
|
|
Loading…
Reference in New Issue