I want to be able to use the value from the inputs and display this in a card separately. Please could you help?
def options_creator(label, id_value):
options = html.Div([label,
dcc.Input(id=id_value, type='text')])
return options
controls = dbc.FormGroup(
[
html.P('Chart Type', style={
'textAlign': 'center'
}),
dcc.Dropdown(
id='chart_dropdown',
options=[{
'label': 'Waterfall',
'value': 'waterfall'
}, {
'label': 'Line Chart',
'value': 'line_chart'
},
{
'label': 'Stacked Chart',
'value': 'stacked_chart'
}
],
value='waterfall', # default value
),
html.Br(),
html.P(id='chart_options'),
html.P(id='option_value')
]
)
sidebar = html.Div(
[
html.H2('Chart Creator', style=TEXT_STYLE),
html.Hr(),
controls
],
style=SIDEBAR_STYLE,
)
content = html.Div(
[
html.H2('Chart', style=TEXT_STYLE),
html.Hr(),
],
style=CONTENT_STYLE
)
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = html.Div([sidebar, content])
@app.callback(
Output('chart_options', 'children'),
Input('chart_dropdown', 'value'))
def chart_creator_iterate(chart):
chart_options_list = []
for value in chart_creator_menu[chart]:
val = options_creator(value, f'{value}_val')
chart_options_list.append(val)
return chart_options_list
if __name__ == '__main__':
app.run_server(debug=True)