小编And*_*rew的帖子

Plotly Dash 无法将 div 放在同一行

在 Plotly Dash 仪表板上,我无法让图表随着屏幕的增长而拉伸,然后在屏幕足够大时并排成一排。如果我对每个图表使用 style={"float:right"} 和 style={"float:left"} ,它会起作用,但图表将不再随屏幕拉伸。我附上了一张结果图的照片。情节超过/低于。我希望它们与一个大浏览器窗口并排,然后与一个中型浏览器窗口缩小,并与一个小浏览器窗口上方/下方。

app = dash.Dash()

app.layout = html.Div([
        dcc.Checklist(
        id='input',
        options=[
            {'label': 'Astoria', 'value': 'AST'},
            {'label': 'Warrenton', 'value': 'WAR'},
            {'label': 'Seaside', 'value': 'SEA'}
        ],
        values=['AST', 'WAR', 'SEA'],
    ),
    html.Div(className='row',
             children=[
        html.Div(
            dcc.Graph(id='value-index'),
            className='col s12 m6', 
            ),
        html.Div(
            dcc.Graph(id='rental-index'),
            className='col s12 m6',
            )
        ],

    )


])


@app.callback(
    Output('value-index', 'figure'),
    [Input(component_id='input', component_property='values')]
    )

def update_graph(input_data):

    return  {
            'data': [
                {'x': astoriaValueIndex.index, 'y': astoriaValueIndex.Value, 'type': 'line', 'name': 'Astoria'},
                {'x': warrentonValueIndex.index, 'y': warrentonValueIndex.Value, 'type': 'line', 'name': 'Warrenton'},
                {'x': …
Run Code Online (Sandbox Code Playgroud)

html dashboard row plotly plotly-dash

4
推荐指数
1
解决办法
5653
查看次数

标签 统计

dashboard ×1

html ×1

plotly ×1

plotly-dash ×1

row ×1