简体   繁体   English

Plotly Dash API文档

[英]Plotly Dash API documentation

I recently started working on my very first dashboard application using dash . 我最近开始使用破折号开发我的第一个仪表板应用程序。

The tutorials are comprehensible, however, I have a hard time handling the front end details because I cannot find an API reference. 这些教程是可以理解的,但是,我很难处理前端细节,因为我找不到API参考。 Specifically, each element accepts a style argument that let's us modify some CSS details, like text alignment, fonts etc. I have seen some examples in the tutorials but I would love to have an exhaustive list of everything I can pass there. 具体来说,每个元素都接受一个style参数,让我们修改一些CSS细节,比如文本对齐,字体等。我在教程中看到了一些例子,但是我希望有一个详尽的列表,列出我可以通过的所有内容。

As an example, I want to create a table but the columns are too close together. 作为一个例子,我想创建一个表,但列太靠近了。 I need to control the spacing between them and I imagine there should be an argument like padding , spacing , borderSize ... you get the point. 我需要控制它们之间的间距,我想应该有一个像paddingspacingborderSize这样的参数......你明白了。 Where can I find these details? 我在哪里可以找到这些细节?

It could be possible to edit some styling by passing some keywords to the Dash component. 可以通过将一些关键字传递给Dash组件来编辑一些样式。 It depends on the component itself. 这取决于组件本身。

For example, if you are using DataTable from dash-table-experiment : 例如,如果您使用dash-table-experiment DataTable

import dash_table_experiments as dt
help(dt.DataTable)

you can see that the API of this component allows you to set things like column_widths (list; optional) and min_width (number; optional). 你可以看到这个组件的API允许你设置像column_widths (list; optional)和min_width (number; optional)这样的东西。

If you need some more complex styling (eg a yellow background with linear gradient for all even table cells) I'm afraid you'll have to know some CSS. 如果你需要一些更复杂的样式(例如所有偶数表格单元格的黄色背景和线性渐变)我恐怕你必须知道一些CSS。

A few additional resources: 一些额外的资源:

Seems the dash project didn't create the user-friendly API document (I guess it was related to their business strategy). 似乎dash项目没有创建用户友好的API文档(我猜这与他们的业务策略有关)。

The only way to get the help is the dash community and git-code project. 获得帮助的唯一方法是破折号社区和git-code项目。

if you want help with python objects in dash then just use: 如果你想在破折号中使用python对象的帮助,那么只需使用:

help(html.Div)

to get a list of argument parameters. 获取参数参数列表。

If you want to know what can be placed in the style parameter the answer is any and all css can be generated. 如果你想知道样式参数中可以放置什么,答案就是任何一个,并且可以生成所有css。 You can customize the look anyway you want here is the syntax... 你可以在这里自定义你想要的外观是语法...

style={
 'border':'1px solid #333', 
 'margin':'10px', 
 'padding':'10px', 
 'background-color':'#888',
 'position':'absolute',
},

The style parameter excepts a dictionary object. style参数除了字典对象。 In order for your CSS to be rendered it needs to be in the syntax above, which will create a python dictionary object. 为了渲染你的CSS,它需要在上面的语法中,这将创建一个python字典对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM