【发布时间】:2021-06-28 08:13:17
【问题描述】:
我正在尝试更改我的 Dash 应用程序的布局,我想要两行,其中第一行有两列,左列有所有下拉列表和单选项目,第二列有“fig2”。然后第 2 行是带有“fig1”的单列我已经编写了 bdc 行和 col 脚本,但似乎我需要一个“子”函数。搜索后,我仍然无法正确编码“儿童”功能。任何人都可以提供任何建议或帮助我吗?
app = dash.Dash()
app.layout = html.Div([
dbc.Row([
dbc.Col(html.Div(
html.Label("Scope"),
dcc.Dropdown(id="Continent1", options=[{'label': 'World', 'value': 'All'},
{'label': 'Asia', 'value': 'asia'},
{'label': 'Africa', 'value': 'africa'},
{'label': 'Europe', 'value': 'europe'},
{'label': 'North America', 'value': 'north america'},
{'label': 'South America', 'value': 'south america'}], value='All'),
html.Br(),html.Label("Data Input"),
dcc.RadioItems(id="Data1", options=[{'label': 'Confirmed Cases', 'value': 'ConfirmedCases'},
{'label': 'Confirmed Deaths', 'value': 'ConfirmedDeaths'},
{'label': 'Stringency Index', 'value': 'StringencyIndex'}], value='Confirmed Cases'),
html.Br(),html.Label("Policy"),
dcc.RadioItems(id="Policy1", options=[{'label': 'Not selected', 'value': 'All'},
{'label': 'Staying at home', 'value': 'Stay at home requirements'},
{'label': 'School closing', 'value': 'School closing'}], value='All'), width=4)),
dbc.Col(html.Div(
dcc.Graph(id="fig2",figure=line), width=4)),
dbc.Row(
dbc.Col(html.Div(
dcc.Graph(id="fig1",figure=geo))))])])
app.run_server(debug=True, use_reloader=False)
【问题讨论】:
-
TypeError:
dash_html_components.Div组件(版本 1.1.3),ID 为“Dropdown(id='Continent1', options=[{'label': 'World', 'value': '全部'}, {'label': 'Asia', 'value': 'asia'}, {'label': 'Africa', 'value': 'africa'}, {'label': 'Europe', '价值':'欧洲'},{'标签':'北美','价值':'北美'},{'标签':'南美','价值':'南美'}],价值='All')" 检测到除children以外的道具的组件您是否忘记将多个children包装在一个数组中? Prop n_clicks_timestamp 的值为 Label('Data Input') -
我运行代码时得到的错误标志在上面
标签: python plotly-dash