我正在try 在仪表板的顶部添加一个横幅.目前,顶部的包含显示卡片和一个侧栏.有没有办法把柱子往下推,并在上面加一条横幅.
我还希望将右侧图形的高度扩展到与左侧的两个图形相同的高度.
我已经附上了当前布局的屏幕截图,其中一些箭头突出了预期的布局.
from dash import Dash
from dash import dcc
from dash import html
import dash_bootstrap_components as dbc
import pandas as pd
import plotly.express as px
# generic card
card = dbc.Card(
[
dbc.CardHeader("This is the header"),
dbc.CardBody(
[
html.H4("Card title", className="card-title"),
html.P("This is some card text", className="card-text"),
]
),
dbc.CardFooter("This is the footer"),
],
className='text-center m-4'
)
external_stylesheets = [dbc.themes.SPACELAB, dbc.icons.BOOTSTRAP]
app = Dash(__name__, external_stylesheets = external_stylesheets)
# Set up the layout with a single graph
app.layout = dbc.Container([
dbc.Row([
# to be used as a sidebar
dbc.Col(html.Div("stuff", className="bg-secondary h-100"), width=2),
dbc.Col([
dbc.Row([
dbc.Col(card),
dbc.Col(card),
dbc.Col(card)
]),
dbc.Row([
dbc.Col(dcc.Graph(), style={
"padding-top": "10px",
"padding-bottom": "10px",
},),
]),
dbc.Row([
dbc.Col([dcc.Graph()]),
]),
], width=5),
dbc.Col([
dbc.Row([
dbc.Col(card),
dbc.Col(card),
dbc.Col(card),
]),
dbc.Row([
dbc.Col([dcc.Graph()]),
], className="h-100"),
], width=5),
])
], fluid=True)
if __name__ == '__main__':
app.run(debug=True)