将“时间框架”下拉列表与日期选择器并排放置,而不要与侧边栏短线Python样式重叠
我试图将时间框架下拉列表与datePicker并排放置,而不会在侧边栏上重叠。这是密码将“时间框架”下拉列表与日期选择器并排放置,而不要与侧边栏短线Python样式重叠,python,plotly,plotly-dash,Python,Plotly,Plotly Dash,我试图将时间框架下拉列表与datePicker并排放置,而不会在侧边栏上重叠。这是密码 from datetime import datetime as dt, timedelta import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc # styling the sidebar SIDEBAR_STYLE = { &qu
from datetime import datetime as dt, timedelta
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
# styling the sidebar
SIDEBAR_STYLE = {
"position": "fixed",
"top": 0,
"left": 0,
"bottom": 0,
"width": "20rem",
"padding": "2rem 1rem",
"background-color": "#f8f9fa",
}
# padding for the page content
CONTENT_STYLE = {
"margin-left": "20rem",
"margin-right": "2rem",
"padding": "2rem 1rem",
}
sidebar = html.Div(
[
html.Div([
html.Img(
src = app.get_asset_url('logo.png'),
height = '100 px',
width = 'auto')
],
className = 'col-1',
dbc.Nav(
[
dbc.NavLink("Page1", href="/", active="exact"),
],
vertical=True,
pills=True,
),
],
style=SIDEBAR_STYLE,
)
content = html.Div([
html.Div([
dcc.Dropdown(
id='timeframe_dropdown',
multi=False,
options=[
{'label': 'Today', 'value': 'Today'},
{'label': 'Yesterday', 'value': 'Yesterday'},
{'label': 'Last 7 days', 'value': 'Last 7 days'},
],
value='Last 7 days',
clearable=False,
style={'flex-wrap': 'nowrap', 'width': '50%', 'padding-left': '200px'}),
dcc.DatePickerRange(
id='datepicker',
display_format='DD-MM-YYYY',
first_day_of_week=1,
min_date_allowed=dt(2019, 1, 1),
max_date_allowed=dt(2021, 2, 28),
style={'flex-wrap': 'nowrap', 'width': '50%', 'padding-left': '200px', 'padding-right': '10px'}
),
])
到目前为止,代码为每个组件创建了2行。但是,我希望能够将它们并排放置。我该怎么做?感谢您的帮助。这不是您正在运行的代码。请发布一个实际可运行的示例。固定未闭合的括号、括号等。。。