✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

multi=True on dropdown not update graph accordingly

Hi All,

I am currently building an app and i am stuck with giving mutli option in my dropdown. It works well without the multi but as soon as i put in the multi option, just the first value updates my graph. When i select the second value from my dorpdown the graphs remain empty.

Below is my code snippet and callback.

html.Div(className='div-for-dropdown',children=[html.P('Select your region'),dcc.Dropdown(id='region-selector',multi=True,options=[{'label':i,'value':i}for i in region_selector_options.keys()],value='North')]),
                        html.Div(className='row',children=[
                            html.Div([html.P('Select Start date'),dcc.DatePickerSingle(id='date-picker1',min_date_allowed=dt(2007,1,1),max_date_allowed=dt(2024,12,1),initial_visible_month=dt(2019,10,1),date=dt(2019,10,1).date(),display_format='YYYY-M-D')]),
                            html.Div([html.P('Select End date'),dcc.DatePickerSingle(id='date-picker2',min_date_allowed=dt(2007,1,1),max_date_allowed=dt(2024,12,1),initial_visible_month=dt(2020,1,1),date=dt(2020,1,1).date(),display_format='YYYY-M-D')]),
                        
def update_graph(region,date1,date2):
    filter1=df[df['Region'].isin([region])]
    filter2=filter1.loc[(filter1['Date_Scrapped']>=str(date1)) & (filter1['Date_Scrapped']<=str(date2))]
    Worker=filter2.groupby('Work_group').size()
    data=go.Bar(x=Worker.index,y=Worker.values)
    
    return {
        'data':[data],
        'layout':go.Layout(
            xaxis_type='category')
    }

If I remember correctly, changing to multi switches the value from a string to a list. I ran into something similar and had to make sure I was passing the value properly. Maybe check (print) the type and value of the input for both single and multi. Just to see what the difference is.