I'm trying to set 2 date pickers in one callback, the purpose of this is to create a plot with two data frames where one corresponds to a filter with the first dropdown and the second one takes the input of the second date filter.
I've the following code: (I'm just going to put part of the code because it is quite large)
cluster = dbc.Form([
dbc.FormGroup([
dbc.Label('Dasboard Visión de Negocios (COVID-19)', html_for="dropdown",style={'font-family': 'arial','font-size': '2rem'}),
dbc.Row([
# =============================================================================
# # Fila de dropdowns
# =============================================================================
dbc.Col([
##### TIME PERIOD
dbc.Label('Periodo:', html_for="dropdown",style={'padding-top': '80px','font-family': 'arial','font-size': '1.1rem'}),
dcc.DatePickerRange(id='periodo_sel',
display_format='DD MMM YYYY',
minimum_nights=1,
start_date=dt(2019,1,1),
end_date=df['EFFECTIVE_START_DATE'].max(),
style={'width': 'max-content','font-family': 'arial'},
day_size = 30),
##### SECOND TIME PERIOD
dbc.Label('Periodo 2:', html_for="dropdown",style={'padding-top': '80px','font-family': 'arial','font-size': '1.3rem'}),
dcc.DatePickerRange(id='periodo_sel2',
display_format='DD MMM YYYY',
minimum_nights=1,
start_date=dt(2019,1,1),
end_date=df['EFFECTIVE_START_DATE'].max(),
style={'width': 'max-content','font-family': 'arial'},
day_size = 30),
......
This is where I'm trying to create the plot:
@app.callback(Output(component_id='product_graph', component_property='figure'),
[Input('periodo_sel','start_date'),
Input('periodo_sel','end_date'),
Input('periodo_sel2','start_date'),
Input('periodo_sel2','end_date'),
Input('periodo_sel','end_date'),
Input('temp_select','value'),
Input('product_select','value')])
def product_plot(start_date, end_date, temp_select, product_select):
"""
Here is where the problem begins, because I don't know how to set a "start2" and "end2", if you see, period has only start and end as property, so when I'm trying to set the second period it becomes redundant and takes the input of the first output
"""
start = pd.to_datetime(start_date)
end = pd.to_datetime(end_date)
start2 = pd.to_datetime(?????)
end2 = pd.to_datetime(?????)
....