如何使用引导程序设置我的Plotly Dash应用的样式?

问题描述 投票:1回答:1

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

最简单的方法是什么?

    ########### 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个回答
0
投票

我正在使用此代码。将样式作为“行内块”添加到您的代码中,使两个图都一致。将两个图形都包含在一个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(),

希望您可以接受并进行修改。

© www.soinside.com 2019 - 2024. All rights reserved.