import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input,Output
import plotly.graph_objs as go
import pandas as pd
app=dash.Dash()
df=pd.read_csv(“kpi.csv”)
name_option=list()
for name in df[‘Name’]:
name_option.append({‘label’:str(name),‘value’:name})
app.layout=html.Div([
html.Div([dcc.Graph(id=‘graph’)]),
html.Div([dcc.Dropdown(id=‘name_picker’,options=name_option,placeholder=‘Select a Name’)])
])
#@app.callback(Output(‘graph’,‘figure’),[Input(‘name_picker’,‘value’)])
@app.callback(
dash.dependencies.Output(‘graph’, ‘figure’),
[dash.dependencies.Input( ‘name_picker’,‘value’)])
def update_figure(selected_name):
filtered_name=df[df[‘Name’]==selected_name]
traces=[]
labels=["Communication Skills","Problem Solving","Team Work","Learning Agility","Motivated","Reliabilty","Resilience","Emotional Intelligence","Integrity"]
#values=df.iloc[(df['Name']==selected_name).index[0],1:].tolist()
values=df.iloc[(df['Name']==selected_name).index[0],1:].tolist()
traces.append(go.Pie(
labels=labels,
values=values
))
return{'data':traces,'layout':go.Layout(title='KPI pie')}
if name==‘main’:
app.run_server(debug=True)
//
csv file
Name,Communication Skills,Problem Solving,Team Work,Learning Agility,Motivated,Reliabilty,Resilience,Emotional Intelligence,Integrity
A,4,4,3,2,4,3,3,4,2
B,4,3,5,3,2,1,3,4,4
C,3,4,5,3,3,4,4,3,3
D,4,4,4,5,4,3,4,3,5
E,4,3,3,3,4,4,5,4,4
F,5,5,5,5,3,2,1,3,2
G,4,4,3,5,3,2,3,4,1
H,4,4,3,2,1,4,4,3,2
F,4,3,3,5,1,2,2,3,2
I am attaching image that shows graph isnt updating. can anyone help please?