首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Plotly-Dash:如何将组件跨越两行

Plotly-Dash:如何将组件跨越两行
EN

Stack Overflow用户
提问于 2021-06-16 21:56:32
回答 1查看 352关注 0票数 0

我正在尝试使用dash和引导网格创建一个仪表板。以下是我试图实现的目标:

根据文档(https://dash-bootstrap-components.opensource.faculty.ai/docs/components/layout/),我可以在行中创建列,但是有没有在列中创建行的方法呢?我需要我的图表跨越两个“行”以前的列。我认为这可以通过以下方式实现:

代码语言:javascript
复制
dbc.Col([dbc.Row([content]),dbc.Row([content]),dbc.Row([content])]),
dbc.Col([dbc.Row([content]),dbc.Row([content]),dbc.Row([content])]),
dbc.Col([dbc.Row([content]),dbc.Row([content])])

然而,这些列只是堆叠在一起。下面是我的前两列代码:

代码语言:javascript
复制
    app.layout =   dbc.Col([
    dbc.Col([ html.H1("temp1",style={'textAlign': 'center' ,'height':'5%','margin-top': '30px', 'margin-bottom': '25px','font-family': 'Consolas'}),
                        dbc.Card(
                            [
                                dbc.CardBody(
                                    [
                                        html.H4(id='card_title_1', children=['Sales'], className='card-title'),
                                        html.P(id='card_text_1', children=['Sample text.'])
                                    ], style={'textAlign': 'center','font-family': 'Consolas'}
                                )
                            ], style={'margin-top': '15px', 'margin-bottom': '15px','height':'30%'}
                        ),
                        dbc.Card(
                            [
                                dbc.CardBody(
                                    [
                                        html.H4(id='card_title_2', children=['Eng'], className='card-title'),
                                        html.P(id='card_text_2', children=['Sample text.']),
                                    ], style={'textAlign': 'center','font-family': 'Consolas'}
                                )
                            ], style={'margin-top': '15px', 'margin-bottom': '15px','height': '30%'}
                        ),
                        dbc.Card(
                            [
                                dbc.CardBody(
                                    [
                                        html.H4(id='card_title_3', children=['Diff'], className='card-title'),
                                        html.P(id='card_text_3', children=['Sample text.']),
                                    ], style={'textAlign': 'center','font-family': 'Consolas'}
                                )
                            ], style={'margin-top': '15px', 'margin-bottom': '15px','height': '30%'}
                        ),
                    ], style={'height': '90vh','width':'50vh'}),


    dbc.Col([ html.H1("temp2",style={'textAlign': 'center' ,'height': '5%','margin-top': '30px', 'margin-bottom': '25px','font-family': 'Consolas'}),
                        dbc.Card(
                            [
                                dbc.CardBody(
                                    [
                                        html.H4(id='card_title_4', children=['Card Title 4'], className='card-title'),
                                        html.P(id='card_text_4', children=['Sample text.']),
                                    ], style={'textAlign': 'center','font-family': 'Consolas'}
                                )
                            ], style={'margin-top': '15px', 'margin-bottom': '15px','height': '30%'}
                        ),
                        dbc.Card(
                            [
                                dbc.CardBody(
                                    [
                                        html.H4(id='card_title_5', children=['Card Title 5'], className='card-title'),
                                        html.P(id='card_text_5', children=['Sample text.']),
                                    ], style={'textAlign': 'center','font-family': 'Consolas'}
                                )
                            ], style={'margin-top': '15px', 'margin-bottom': '15px','height': '30%'}
                        ),
                        dbc.Card(
                            [
                                dbc.CardBody(
                                    [
                                        html.H4(id='card_title_6', children=['Card Title 6'], className='card-title'),
                                        html.P(id='card_text_6', children=['Sample text.']),
                                    ], style={'textAlign': 'center','font-family': 'Consolas'}
                                )
                            ], style={'margin-top': '15px', 'margin-bottom': '15px','height': '30%'}
                        ),
                    ], style={'height': '90vh','width':'50vh'}),
], style={'height': '100vh', 'width':'100vh'})
EN

回答 1

Stack Overflow用户

发布于 2021-06-17 05:09:52

我可以通过将dbc.Col放在html.Div中,然后给每个dbc.Col一个CSS style = 'display : inline-block‘来解决这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68004138

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档