Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

How to use @app.callback to check if multi attribute of dropdown is True or False

$
0
0

This is part of my code :

    html.H1(children='Market analysis',
            style={'textAlign': 'center'}
            ),
    dcc.Tabs(id='tabs', value='tab-1    ',
             vertical=True,
             children=[
                 dcc.Tab(label='Hourly Returns', value='tab-1'),
                 dcc.Tab(label='Returns', value='tab-2')
             ]),
    html.Div(id='tabs-content-example', children=tab2),

    dcc.Dropdown(id='sym', value='btcusd',
                 className='tab-content-htmldiv',
                 clearable=False, multi=True, options=[
            {'label': 'btcusd', 'value': 'btcusd'},
            {'label': 'ethusd', 'value': 'ethusd'},
            {'label': 'ltcusd', 'value': 'ltcusd'},
            {'label': 'xrpusd', 'value': 'xrpusd'}]),

    dcc.Dropdown(id='exc', value='bf',
                 className='secondslide-content-htmldiv',
                 clearable=False, options=[
            {'label': 'bf', 'value': 'bf'},
            {'label': 'bs', 'value': 'bs'},
            {'label': 'cb', 'value': 'cb'},
            {'label': 'ib', 'value': 'ib'},
            {'label': 'kk', 'value': 'kk'}
        ]),

    dcc.Tabs(id='timetabs', value='12', parent_className="secondtab-second-tab",
             children=[
                 dcc.Tab(label='12d', value='12'),
                 dcc.Tab(label='1m', value='1'),
                 dcc.Tab(label='3m', value='3'),
                 dcc.Tab(label='6m', value='6')
             ]),

    html.Div([html.Img(id='tabs-example-content', src='')], className='figure-display')
])
 
@app.callback(Output('tabs-content-example', 'children'),
              [Input('tabs', 'value')])
def render_content(tab):
    if tab == 'tab-1':
        return tab1
    elif tab == 'tab-2':
        return tab2

@app.callback(Output('sym', 'multi'),
              [Input('returns', 'value')])
def update_dropdown(value):
    if value == 'Daily':
        return True
    elif value == 'Hourly':
        return False

Once mutli value is set how can i check in other callback if its value is true or false ?

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles