Hi,
I have been trying to connect six callbacks to this graph in the above picture (Region and Equipment have hierarchies that lead to the bottom dropdown) and believe I have isolated the problem to the slider below.
html.Div([dcc.RangeSlider(
id='my-range-slider',
min=2010,
max=2017,
step=None,
marks={2010:'2010',
2011:'2011',
2012:'2012',
2013:'2013',
2014:'2014',
2015:'2015',
2016:'2016',
2017:'2017'})
], style={'textAlign': 'right','width':'87%'})
], style=tab_style, selected_style=tab_selected_style),
I think I may not be understanding the slider component as I can’t tell if the problem is the datatype with the dates in my spreadsheet (currently they are numbers/integers) or if its the way my callback is designed. The code for my callbacks is seen below (Measure and Time Frame are different columns I am selecting from rather than selecting values from a column) :
@app.callback(
dash.dependencies.Output('linear','figure'),
[dash.dependencies.Input('country','value'),
dash.dependencies.Input('Equipment_Sub_Category','value'),
dash.dependencies.Input('brand','value'),
dash.dependencies.Input('my-range-slider','values'),
dash.dependencies.Input('Time','value'),
dash.dependencies.Input('Measure','value')
])
def update_graph(country_name,category_name,brand_name,year_name,time_name,measure_name):
Total1=Total[Total['Country_Name'] == country_name]
Total2=Total1[Total1['Equipment_Category'] ==category_name]
Total3=Total2[Total2['Manufacturer_Name'] ==brand_name]
Total4=Total3[Total3['Year'] ==year_name]
x=Total4[time_name]
y=Total4[measure_name]
trace1=go.Bar(x=x,y=y,marker=dict(
color='rgb(0,191,255)', # code for sky blue 0,191,255
line=dict(
color='rgb(8,48,107)',
width=1.5,
)),opacity=0.6,name='Units')
layout=go.Layout(xaxis={'title': 'Time Frame'},
title= 'Shipment',
hovermode='closest',
margin={"t": 25, "l": 25, "r": 25},
height=225)
return {'data':[trace1],
'layout':[layout]}
I was wondering if there was something I am missing, as I can’t tell why the graph ( and actually the layout won’t show up).
A sample of my data can be seen below: