Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

DatePickerRange and callback in Dash

Hello,
when I add a DatePicker in Dash I need to do :
@app.callback(Output(‘mygraph’, ‘figure’), [Input('date-picker, ‘value’)]

but how do I do with DatePickerRange as there are start_date and end_date ?
I tried : @app.callback(Output(‘mygraph’, ‘figure’), [Input(‘date-picker-range’, ‘start_date’, ‘end_date’)]
but I get an error …
Idem if I do [Input(‘date-picker-range’, [‘start_date’, ‘end_date’] )]

How can I send the 2 values ? Thank you!

You need to create two Inputs for callback, targeting the ‘start_date’ and ‘end_date’ properties respectively. There are examples in how to do this in the documentation: https://plot.ly/dash/dash-core-components/datepickerrange

1 Like

It works~ Thank you for the solution

1 Like