python-3.x - Python Plotly-Dash 从清单中删除“内联”,因此项目位于单独的行中
问题描述
我正在使用 Plotly 的 Dash 库创建一个清单,我希望每个项目都在自己的行中,但我不知道如何。请注意下图中“Delta P (PSI)”和“Horsepower”如何位于同一条线上,这是我不想要的。
有任何想法吗?这是我的代码:
import dash
import dash_html_components as html
import dash_core_components as dcc
# Items to chart (checklist), based on unit type
html.Label('Items to Chart'),
dcc.Checklist(
options = [
{'label': 'Delta P (PSI)', 'value': 'dtp'},
{'label': 'Horsepower', 'value': 'hpe'},
{'label': 'Hydraulic temp (C)', 'value': 'ht_egas'},
],
# What to use for className???
className="checkbox or something..."
),
解决方案
我想到了:
labelStyle = dict(display='block') # not 'inline'
https://dash.plot.ly/dash-core-components/checklist
import dash
import dash_html_components as html
import dash_core_components as dcc
# Items to chart (checklist), based on unit type
html.Label('Items to Chart'),
dcc.Checklist(
options = [
{'label': 'Delta P (PSI)', 'value': 'dtp'},
{'label': 'Horsepower', 'value': 'hpe'},
{'label': 'Hydraulic temp (C)', 'value': 'ht_egas'},
],
labelStyle = dict(display='block')
),
推荐阅读
- javascript - “路由器”类型上不存在属性“导航”。您指的是 'navigated' 吗?
- xcode - 添加用户时 App Store Connect 允许开发人员资源复选框
- javascript - Javascript 类方法装饰器访问 this
- unetstack - 使用带有 groovy 脚本的 unetstack 查找两个节点之间的距离
- python - ctrl 单击不适用于 python 项目 pydeveditor
- ionic-framework - 为离子标签项目设计样式
- arrays - 您可以将函数存储在数组中并根据需要调用它们吗?
- ruby-on-rails - ActiveRecord::RecordInvalid:验证失败:密钥不能为空
- django - 努力在 DetailView 页面中显示复选框数据
- javascript - 如何在 JavaScript 中使用 PHP?