Here is my code… I am not sure where I am going wrong, Can you anyone please help ?
app = dash.Dash(name)
words = [“BR”,“Pier”,“Area”,“N61”, “Airtran”, “Footing”, “BackFill”, “Span”, “N62”, “Deck”, “Pile”, “N62”, “N63”, “F/R/P”, “Excavate”, “Cap”]
app.layout = html.Div(children = [html.H1([‘Project N61’]),
dcc.Dropdown(id = ‘dd’, options = [{‘value’:w,‘label’:w} for w in words],value = ‘Pile’),
dcc.Graph(id=‘graph’)])
@app.callback(dash.dependencies.Output(‘graph’,‘figure’),[dash.dependencies.Input(‘dd’,‘value’)])
def get_for_activity(value):
return df[df[‘Activity Name’].str.contains(value)]
df_year = get_for_activity(‘value’)
for Activity_Type in df_year['Activity Type'].unique():
df_at= df_year.loc[df_year['Activity Type'] == 'Finish Milestone']
Current_Finish = go.Scatter(x = df_year['Activity Name'],y = df_year['Finish'],mode = 'lines', name = 'Current Finish')
BaseLine_Finish = go.Scatter(x = df_year['Activity Name'],y = df_year['BL1 Finish'],mode = 'lines',name = 'BL1 Finish')
Milestones = go.Scatter(x = df_at['Activity Name'],y = df_at['Primary Constraint Date'],mode = 'markers',name = 'Planned Milestones')
Milestones_CF = go.Scatter(x = df_at['Activity Name'],y = df_at['Finish'],mode = 'markers',name = 'Milestones_CF')
figure = {'data':[Current_Finish, BaseLine_Finish,Milestones, Milestones_CF],'layout':go.Layout(title = 'Project Level Analysis')}
return figure
if name == ‘main’:
app.run_server()