def update_chart_selector(intent): if intent: charts = NormalData.get_charts_by_intent(intent=intent) options = [ {'label': chart.value, 'value': chart.value} for chart in charts ] value = charts[0].value return options, value raise dash.exceptions.PreventUpdate()
{'id': 'property', 'name': 'property', 'editable': False}, {'id': 'y_axis', 'name': 'y_axis', 'presentation': 'dropdown'}, {'id': 'chart', 'name': 'chart', 'presentation': 'dropdown'} ], dropdown={ 'y_axis': { 'options': [ {'label': i, 'value': i} for i in ['y1', 'y2', 'y3', 'y4', 'y5'] ] }, 'chart': { 'options': [ {'label': chart_type.value, 'value': chart_type.value} for chart_type in NormalData.get_charts_by_intent(IntentType.compare_self) ] } }, editable=True ), ), html.Div(id='table-type-label', children=None), html.Div( [ html.Div([dcc.Dropdown(id='intent-selector')], style={'width': '50%', 'display': 'inline-block'}), html.Div([dcc.Dropdown(id='chart-selector')], style={'width': '50%', 'display': 'inline-block'}) ]