Hello,
I’ve built a code to plot two graphs first given the selection in the first Dropdown and second given the selection in the second Dropdown, but I keep getting error of unhashable type 'list'
this is my code:
app.layout = html.Div([
dcc.Dropdown(
id="sector",
options=[{"label": x, "value": x}
for x in list(fnameDict.keys())],
value=list(fnameDict.keys())[0],
clearable=False,
multi=True,
),
dcc.Dropdown(
id="ticker",multi=True,
),
dcc.Graph(id="time-series-plot"),
dcc.Graph(id="time-series-chart"),
])
@app.callback(
Output('time-series-plot', 'figure'),
[Input("sector", "value")])
def show_time_series(sector):
plty = px.line(xxxx, x=xxxx.index, y=sector)
return plty
@app.callback(
Output('ticker', 'options'),
[Input("sector", "value")])
def update_date_dropdown(name):
return [{'label': i, 'value': i} for i in fnameDict.get(name)]
@app.callback(
Output("time-series-chart", "figure"),
[Input("ticker", "value")])
def display_time_series(ticker):
fig = px.line(df, x=df.index, y=ticker)
return fig
app.run_server(debug=True)
my
fnameDict
is a dict containing list of values
I want that given 1 selection of Dropdown my values of 2 Dropdown change given the selection in 1 Dropdown
in other word 1 Dropdown contain keys and 2 Dropdown contain values of the selected key
does anyone know how to fix this please?