Hello everybody,
I was wondering if anyone can help me
I want to add an other dropdown to select a variable from the columns
well i created a dropdown to select the year and i want to add a new one to select a variable from the 3rd to the 10th columns and then to create an histogram for each variable selected( in the selected year )
here’s my code ( which only select the year )
html.H1(‘select the year’),
dcc.Dropdown(
id=‘my-dropdown’,
options=[
{‘label’: c, ‘value’: c} for c in year
],
value='2011'
),
dcc.Graph(id='my-graph')
], className=“container”)
])
@app.callback(dash.dependencies.Output(‘my-graph’, ‘figure’),
[dash.dependencies.Input(‘my-dropdown’, ‘value’)]
)
def update_graph(selected_dropdown_value):
dff = data[data[‘year’] == selected_dropdown_value]
return {
‘data’: [ {
‘x’: dff.nom,
‘y’: dff.var1 (column’s name)
,
“type”: “bar”,
“marker”: {“color”: “#0074D9”},
}],
'layout': {
'margin': {
'l': 30,
'r': 20,
'b': 30,
't': 20
}
}
}