I am trying to build a bar chart using dash plotly and while the dropdown is getting selected, it is unable to refresh the page with the selected value from dropdown. I am new to Dash. Any help will be appreciated.The graph is ok with the defult value being selected (that is "FII’ in this case), however the moment I select different value ( I have FII,DII,Pro,Total) values in Client_Type.
df = df1[df1['Month'].isin([2,3])]
app = dash.Dash()
df = df1[df1['Month'].isin([2,3])]
app = dash.Dash()
party_data = []
for client in df['Client_Type'].unique():
party_data.append({'label': client, 'value': 'Client_Type'})
app.layout = html.Div([
dcc.Graph(id='graph'),
dcc.Dropdown(id='client-picker',options=party_data,value= 'FII' )
])
@app.callback(Output('graph', 'figure'),
[Input('client-picker', 'value')])
def update_figure(abc):
df1 = df[df.Client_Type == abc]
print(df1.head())
date1 = df1['Date']
Fut_Index_Long1 = df1['Fut_Index_Long']
return {
'data': [go.Bar(x=date1, y=Fut_Index_Long1)]
}
if __name__ == '__main__':
app.run_server(debug=True)