Hey,
Has anyone had issues with callbacks not recognizing graph controls and such when they’re contained in dash bootstrap components?
I’m rewriting an app I wrote last year using dash bootstrap components and when I put a rangeslider for a graph instead a dbc.Row or dbc.Col, it errors on the callback like it can’t find the slider.
Works:
dbc.Row(
dbc.Col(params, width=4)
),
html.Div(className='col-lg-8',
children=[
html.H4("MW and Temperature By Year", style={'padding-top':'0px'}),
dcc.Graph(
id='graph',
figure={
'data': [
go.Scatter(x=X, y=Y, mode='markers', marker = {'color':'#5bc0de', 'opacity':0.7, 'line': {'width': 0.5, 'color': 'white'}})
],
'layout': go.Layout(
xaxis={'title': 'Temperature'},
yaxis={'title': 'MW'},
margin={'l': 40, 'b': 40, 't': 10, 'r': 10},
legend={'x': 0, 'y': 1},
)
}, animate=False, style={'height': '325px', 'width': '80vw'}
),
dcc.RangeSlider(
id='year_slider',
min=minYear,
max=maxYear,
value=[startYear, endYear],
marks={i: str(i) for i in range(minYear, maxYear)}
)], style={'padding-top': '5px', 'padding-bottom': '5px', 'width':'80vw', 'height': '350px'})
doesn’t work:
dbc.Row(
dbc.Col(params, width=6),
html.Div(className='col-lg-8',
children=[
html.H4("MW and Temperature By Year", style={'padding-top':'0px'}),
dcc.Graph(
id='graph',
figure={
'data': [
go.Scatter(x=X, y=Y, mode='markers', marker = {'color':'#5bc0de', 'opacity':0.7, 'line': {'width': 0.5, 'color': 'white'}})
],
'layout': go.Layout(
xaxis={'title': 'Temperature'},
yaxis={'title': 'MW'},
margin={'l': 40, 'b': 40, 't': 10, 'r': 10},
legend={'x': 0, 'y': 1},
)
}, animate=False, style={'height': '325px', 'width': '80vw'}
),
html.Div([dcc.RangeSlider(
id='year_slider',
min=minYear,
max=maxYear,
value=[startYear, endYear],
marks={i: str(i) for i in range(minYear, maxYear)}
)], style={'padding-top': '5px', 'padding-bottom': '5px', 'width':'80vw', 'height': '350px'})])
)
I’ve tried using all dbc components, html divs with bootstrap css and a mix of the two, and the range slider only seems to work when it’s NOT contained in a dbc component. Is there a reason for this? Am I missing something?