Na zpětné volání jsem si dvě chyby:
- Vlastnost "slidevalue" byl použit s component ID: "ageslider" v jedné Vstupní položky zpětného volání. Toto ID je přiřazen k dash_core_components.RangeSlider součást v uspořádání, které nepodporuje tuto vlastnost.
- TypeError: 'NoneType' objekt není subscriptable
Můj kód je:
dbc.Col([
html.Div(id='Title_Slider', children='''Milo na ena LOLA''',
style={'margin-bottom':'50px', 'text-align':'center'}),
html.Div(dcc.RangeSlider(id='**ageslider**',min=18,max=60,step=1,value=[18,60],
marks={str(Age): str(Age) for Age in data.Age.unique()}
), style={'width': '100%', 'padding': '0px 20px 20px 20px'}),
a
@app.callback(
Output('bar-1', 'figure'),
Input('dropdown1','value'),
Input('ageslider','slidevalue'),
Input('binat','bivalue'))
def update_line_chart(filter_metric, **vage** , bi_value):
v_min = **vage**[0]
v_max = **vage**[1]
#age_filter is a custom func that works
datac_ = age_filter(data, v_min, v_max)
a=datac_.groupby([filter_metric,'Attrition']).apply(lambda x:x[filter_metric].count()).reset_index(name='Counts')
fig = px.line(a, x=filter_metric, y="Counts", color='Attrition',markers=True,height=500, width=700)
fig.update_layout(plot_bgcolor=colors['background'],paper_bgcolor=colors['background'], font_color=colors['text'])
return fig
Ví někdo, proč RangeSlider čelí tento problém??