Hey there, I´m trying to create a dropdown menu using the df column names as options, also need to update the pie plot depending of the selected option…
Here´s the code:
i = 0 # Counter
for col in df:
values = filter_df_trimmed[col].value_counts()
labels = values.index.unique()
#fig = go.Figure(data=[go.Pie(labels=labels, values=values, title=df.columns[i])]) #plotly go
fig = px.pie(filter_df_trimmed, values=values, names=labels, title=df.columns[i], hole=.3, color_discrete_sequence=px.colors.sequential.Mint) #plotly express
i = i+1
valuess = filter_df_trimmed[col].to_list()
labels = values.index.unique()
column2 = dbc.Col(
[
dcc.Dropdown(id='stockselector',
options=labels,
#multi=True,
value=valuess,),
dcc.Graph(figure=fig),
]
)
layout = dbc.Row([column1, column2])