📅  最后修改于: 2022-03-11 14:58:05.693000             🧑  作者: Mango
app.layout = html.Div([
html.Div([
html.H1('Stock Tickers'),
dcc.Dropdown(
id='my-dropdown',
options=[
{'label': 'A', 'value': 'A'},
{'label': 'B', 'value': 'B'},
{'label': 'C', 'value': 'C'}
],
value='A'
)
],
style={'width': '20%', 'display': 'inline-block'}
),
dcc.Dropdown(
id='my-dropdown1',
options=[
{'label': '250,000', 'value': '250000'},
{'label': '500,000', 'value': '500000'},
{'label': '750,000', 'value': '750000'},
{'label': '1,000,000', 'value': '1000000'}
],
value='250000'
),
dcc.Graph(id='my-graph')
], className="container")
@app.callback(Output('my-graph', 'figure'),
[Input('my-dropdown', 'value'), Input('my-dropdown1', 'value')])
def update_graph(selected_dropdown_value, selected_imp_value):
dff = df[(df['Demo'] == selected_dropdown_value) & (df['Imp_cap'] == selected_impresession_value)]
return {
'data': [{
'x': dff.Imp
'y': dff.user,
'line': {
'width': 3,
'shape': 'spline'
}
}],
'layout': {
'margin': {
'l': 30,
'r': 20,
'b': 30,
't': 20
}
}
}