Hi I am relatively new to dash and have been trying to recreate a dashboard I made in tableau using Dash.I am trying to create the following image:
my questions are the following:
- How can I add vertical scroll to my bar graph?
- How can I make that particular graph in general. I tried using going the subplot route but I cant seem to get the image to populate on my dashboard. I used the following link to create a sub plot version of the graph. Link: https://plot.ly/python/subplots/
I have tried using the following to make the image populate on my dashboard:
@app.callback(Output(âmonthly_mins_modelâ, âfigureâ),
[Input(âmodel_filterâ, âvalueâ),
Input(âSite_Filterâ, âvalueâ),
Input(âMachine_Number_Filterâ, âvalueâ),
Input(âUtilization_Filterâ, âvalueâ),
Input(âCountry_Filterâ, âvalueâ)
])
def update_monthly_mins_model_graph(model,site,machine,utilization,country):
temp = filter_raw_dataframe(raw_data, model,site,machine,utilization,country)
temp = temp.groupby([âYearâ,âMonthâ,âmachine_name_matchedâ]).mean()[âminsâ]
temp = temp.reset_index()
temp = temp.sort_values([âYearâ, âMonthâ], ascending=[True, True])
temp[âMonth_Yearâ] = temp.Month.astype(âstrâ) + â/â + temp.Year.astype(âstrâ)
fig = tools.make_subplots(rows=len(temp.machine_name_matched.unique()), cols=1)
for i in temp.machine_name_matched.unique():
i = 0
fig.append(go.Bar(
x=temp[temp.machine_name_matched==i].Month_Year,
y=temp[temp.machine_name_matched==i].mins,
showlegend=True,
orientation = 'v'
),i+1,1)
i +=1
fig['layout'].update(title='Stacked subplots')
return py.iplot(fig, filename=âstacked-subplotsâ) # I have also tried to return just the fig
Any help with this will be much appreciated.