I am running the dash app on Jupiter. Everything seems to work until I kept multi=True
and adjusted my code below but now it shows an empty graph. What could be wrong:
app = JupyterDash('Simple_App')
app.layout = html.Div([
dcc.Dropdown(id="select_company",
options=[{"label":x, "value":x} for x in df2.company].append({"label":"Alle option", "value":"Alle option"}),
multi=True,
value="ABC company",
style={'width': "65%"}
),
html.Div(id='output_container', children=[]),
html.Br(),
dcc.Graph(
id='barplot_graph',
config={
'displaylogo': False,
"toImageButtonOptions": {"width": None, "height": None}
},
figure={}
)
])
@app.callback(
[Output(component_id='output_container', component_property='children'),
Output(component_id='barplot_graph', component_property='figure')],
[Input(component_id='select_company', component_property='value')]
)
def update_graph(option_slctd):
container = "Company stats: {}".format(option_slctd)
if "Alle option" in option_slctd:
df_filter = df2.copy()
else:
df_filter = df2[df2["company"].isin(option_slctd)]
# Plotly Express
fig = px.bar(df_filter,
x="Month",
y="Frequency",
barmode="group",
template = "plotly_dark",
height=500)
return container, fig
app