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.