无法在 1 行中绘制 2 个图表 - 破折号
Trouble plotting 2 charts in 1 row - dash plotly
我正在尝试构建一个在同一行显示 2 个图表的仪表板。我同时使用 dbc.Row
和 dbc.Col
来划分部分,但我不确定代码有什么问题,因为图表显示在彼此之上而不是并排显示。我尝试添加 style={"width": "45%", "margin-top": "1%","margin-left": "0%", "margin-right": "0%"}
并与第二个图表相反,但仍然只在单独的行中显示图表。
任何帮助将不胜感激。
html.Div([
dbc.Row([
dbc.Col(
html.Div([
dcc.Dropdown(id='dropdown-1', multi=True, value=('EC'),
options=[{'label': x, 'value': x}
for x in sorted(dfdate['Campaign'].unique())]),
dcc.Graph(id='date-graph', figure=fig_cpa_date),
]), width={'size': 3}
),
dbc.Col(
html.Div([
dcc.Dropdown(id='dropdown-2', multi=True, value=('EC'), style={"margin-top": "1%"},
options=[{'label': x, 'value': x}
for x in sorted(dfdate['Campaign'].unique())]),
dcc.Graph(id='spend-graph', figure=fig_spend),
]), width={'size': 3}
),
]),
])
像这样尝试,只为 Col:
的 children[] 更改 html.Div([])
dbc.Row([
dbc.Col(
children=[
dcc.Dropdown(id='dropdown-1', multi=True, value = ('EC'),
options= [{'label': x, 'value': x}
for x in sorted (dfdate['Campaign'].unique())]),
dcc.Graph(id='date-graph', figure=fig_cpa_date),
], width=3
),
dbc.Col(
children=[
dcc.Dropdown(id='dropdown-2', multi=True, value=('EC'), style={"margin-top": "1%"},
options=[{'label': x, 'value': x}
for x in sorted(dfdate['Campaign'].unique())]),
dcc.Graph(id='spend-graph', figure=fig_spend),
], width=3
),
]),
我正在尝试构建一个在同一行显示 2 个图表的仪表板。我同时使用 dbc.Row
和 dbc.Col
来划分部分,但我不确定代码有什么问题,因为图表显示在彼此之上而不是并排显示。我尝试添加 style={"width": "45%", "margin-top": "1%","margin-left": "0%", "margin-right": "0%"}
并与第二个图表相反,但仍然只在单独的行中显示图表。
任何帮助将不胜感激。
html.Div([
dbc.Row([
dbc.Col(
html.Div([
dcc.Dropdown(id='dropdown-1', multi=True, value=('EC'),
options=[{'label': x, 'value': x}
for x in sorted(dfdate['Campaign'].unique())]),
dcc.Graph(id='date-graph', figure=fig_cpa_date),
]), width={'size': 3}
),
dbc.Col(
html.Div([
dcc.Dropdown(id='dropdown-2', multi=True, value=('EC'), style={"margin-top": "1%"},
options=[{'label': x, 'value': x}
for x in sorted(dfdate['Campaign'].unique())]),
dcc.Graph(id='spend-graph', figure=fig_spend),
]), width={'size': 3}
),
]),
])
像这样尝试,只为 Col:
的 children[] 更改 html.Div([])dbc.Row([
dbc.Col(
children=[
dcc.Dropdown(id='dropdown-1', multi=True, value = ('EC'),
options= [{'label': x, 'value': x}
for x in sorted (dfdate['Campaign'].unique())]),
dcc.Graph(id='date-graph', figure=fig_cpa_date),
], width=3
),
dbc.Col(
children=[
dcc.Dropdown(id='dropdown-2', multi=True, value=('EC'), style={"margin-top": "1%"},
options=[{'label': x, 'value': x}
for x in sorted(dfdate['Campaign'].unique())]),
dcc.Graph(id='spend-graph', figure=fig_spend),
], width=3
),
]),