我如何安排 Dash Plotly 上的按钮位置?
How can i arrange button location on Dash Plotly?
我正在使用 Plotly 的 Dash 制作仪表板。它对我来说真的很快而且很有用。但是我找不到如何安排按钮的位置。例如,我希望按钮为 x=5,y=150。但是我找不到关于文档的解决方案。此外,我检查了 github 中的破折号核心组件,但找不到 x 坐标或位置等地方。我是否需要以某种方式添加 react.js 代码?提前致谢。
我假设您不是要以这种方式创建整个布局,而只是想在您想要的 x 和 y 位置放置一个特定按钮。
可以使用dash-mantine-components自带的Affix组件。
PS: I'm the author of this library.
import dash_mantine_components as dmc
from dash import Dash, html
app = Dash(__name__)
app.layout = html.Div(
[
dmc.Affix(
dmc.Button("I'm in an affix component!"), position={"top": 5, "left": 150}
)
]
)
if __name__ == "__main__":
app.run_server(debug=True)
Output
我正在使用 Plotly 的 Dash 制作仪表板。它对我来说真的很快而且很有用。但是我找不到如何安排按钮的位置。例如,我希望按钮为 x=5,y=150。但是我找不到关于文档的解决方案。此外,我检查了 github 中的破折号核心组件,但找不到 x 坐标或位置等地方。我是否需要以某种方式添加 react.js 代码?提前致谢。
我假设您不是要以这种方式创建整个布局,而只是想在您想要的 x 和 y 位置放置一个特定按钮。
可以使用dash-mantine-components自带的Affix组件。
PS: I'm the author of this library.
import dash_mantine_components as dmc
from dash import Dash, html
app = Dash(__name__)
app.layout = html.Div(
[
dmc.Affix(
dmc.Button("I'm in an affix component!"), position={"top": 5, "left": 150}
)
]
)
if __name__ == "__main__":
app.run_server(debug=True)
Output