首页 > 解决方案 > 在图形右侧绘制短划线图形输入

问题描述

我有一个带有输入框的绘图图。

在此处输入图像描述

有没有办法将这些输入框发送到图表的右侧。我已经检查了文档,但该部分中似乎没有提到这一点dcc.Inputhttps://dash.plotly.com/dash-core-components/input

app.layout = html.Div(
    [
        dcc.Input(
            id = "input_{}".format(_),
            type = _,
            placeholder="input type {}".format(_),
        )
        for _ in ALLOWED_TYPES
    ]
    + [dcc.Graph(id='graph', figure=fig, style={'width': '90vh', 'height': '90vh'})]
)

dcc.Input似乎没有这个选项。谢谢你的帮助。

标签: djangoplotlyplotly-dash

解决方案


您可以使用stylepropdcc.Input来将输入元素与 CSS 对齐。

dcc.Input(
  ...
  style={"float": "right"},
)

或者,如果您想对输入元素的定位方式进行更多控制,则可以始终使用 Flexbox。这将涉及style在外部设置 prop html.Divdisplay: flex然后您可以为输入元素使用 flex 属性。


推荐阅读