✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Dropdown with output two Graphs

Hello all,
I was struggling with case below:
If I have one dropdown, with multi = True, I want everytime I click a new value in dropdown, a new graph is added. So, one graph, one value.
So far, I can only produce one graph with multiple value.

with my code below:

Blockquote
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import pandas as pd

app = dash.Dash()
app.layout = html.Div([

html.Div(
    [
        dcc.Dropdown(
            multi=True,
            id="city",
            options=[{'label': i,'value': i} for i in city_options],
            value='all city'),
    ],
    style={'width': '25%',
           'display': 'inline-block'}),
dcc.Graph(id='curah-graph',animate=True)

])
@app.callback(dash.dependencies.Output(‘curah-graph’, ‘figure’), [dash.dependencies.Input(‘city’, ‘value’)])
def update_graph(grafik):
traces = []
for i in grafik:
df_plot = df.loc[df[‘city’] == i]
trace = {‘x’: df_plot[‘Month’],‘y’:df_plot[‘raindrops’], ‘name’: i}
traces.append(trace)
return {‘data’: traces}
#if name == ‘main’:

app.run_server(debug=True)