【问题标题】:How to style my Plotly Dash app using bootstrap?如何使用引导程序设置我的 Plotly Dash 应用程序的样式?
【发布时间】:2019-08-24 19:21:34
【问题描述】:

这是我的代码。 我正在尝试将两个图表对齐。

最简单的方法是什么?

    ########### Display the chart
    app = dash.Dash()
    server = app.server

    app.layout = html.Div(style={'backgroundColor': '#000000'},children=[
        html.H1('Indicator'),
        dcc.Graph(
            id='Teste1',
            figure=client_relation
        ),

        dcc.Graph(
            id='Test2',
            figure=beer_fig
        ),


        ]
    )

    if __name__ == '__main__':
        app.run_server()

【问题讨论】:

    标签: python css plotly plotly-dash


    【解决方案1】:

    我正在使用此代码。将样式作为“inline-block”添加到您的代码中,以使两个图形对齐。 将两个图表包含在一个 html 块中。

    dcc.Graph(id='my_graph1',style={'width':1000, 'display': 'inline-block'},
            figure=go.Figure(
                data =[trace1, trace2],
                layout = go.Layout(
                title=' nifty',
    
                xaxis=dict(
                    #domain=[0.03, 0.9]
                    title='Date',
                ),
                yaxis=dict(
                    title='Nifty',
                    side='right',
                ), 
            ),
    
    dcc.Graph(id='Pie',style={'width': 500, 'display': 'inline-block'},
    ),
    
    html.Hr(),
    

    希望你能接受并修改。

    【讨论】:

      猜你喜欢
      • 2020-04-22
      • 1970-01-01
      • 2019-10-04
      • 2020-08-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-19
      • 2020-09-04
      • 2020-12-14
      相关资源
      最近更新 更多