Hi,
I have a dash app where a RadioItems and Dropdown dcc are determined by callback from another dcc element in the app. Now, i want to use these two dcc values as inputs to function of another call back, but i am not sure how to refer to them. This is the code:
data_type = [‘F’, ‘M’, ‘R’]
data_dict = data_namer(names_list[:-2])[0]
plot_type = [‘Chi’, ‘AD’, ‘KS’]
app = Dash()app.layout = html.Div(id = ‘main-div’,
children=[
html.H4(‘Raw data Statistical tests’),
html.P(‘Chose data type:’),
dcc.RadioItems(data_type, data_type[0], id = ‘type-picker’),
html.P(‘Chose data:’),
dcc.Dropdown(options = [‘Chose’], id = ‘data-picker’, multi = True),
#html.P(‘Chose R-test type:’), dcc.RadioItems(id = ‘R-type’, options = [‘chose’]),
html.P(‘Chose plot:’),
dcc.RadioItems(options=[‘Chose’], id=‘plot-picker’),
dcc.Graph(id = ‘plot’)
])
@app.callback(Output(‘data-picker’,‘options’), [Input(‘type-picker’, ‘value’)])
def data_picker(data_type):
return data_dict[data_type]@app.callback(Output(‘plot-picker’,‘options’), [Input(‘type-picker’, ‘value’)])
def plot_picker(data_type):if data_type == 'R': return ['chi', 'ks', 'ks_D_below_1', 'ad', 'chi_row', 'ad_row'] if data_type == 'M': return ['chi', 'ks', 'ks_1', 'ad'] if data_type == 'F': return ['chi', 'ks', 'ks_1', 'ad']
@app.callback(Output(‘plot’,‘figure’), [Input(‘type-picker’, ‘value’), Input(‘data-picker’, ‘value’), Input(‘plot-picker’, ‘options’)])
def plot(data_type, ):
path = app.layout[‘data-picker’].options[0]+‘/’+f’{data_type}‘+’_test’
name = app.layout[‘data-picker’].options[0]
test=test_stat(path, f’{data_type}‘)
test.stat_test()
plot = plot(test, f’{data_type}', name)
plot.plots()
In the plot function, i want to refer to the variable coming from the data-picker and plot-picker after they are defined by the previous callbacks.
any help is appreciated.
thanks