【问题标题】:How to adjust the margins in Plotly Dash DAQ components?如何调整 Plotly Dash DAQ 组件的边距?
【发布时间】:2019-12-17 09:17:18
【问题描述】:

我使用 Plotly dash DAQ gauge component 创建了一个仪表图,并且需要减少底部边距,因为它过多。有什么想法吗?

我尝试在样式组件中使用多个配置作为边距(参见代码示例),但这没有奏效。

import dash_daq as daq

daq.Gauge(
    style={
        'color': Colors.text,
        'marginBottom': '0px',
        'margin-bottom': '0px'
    },
    min=0,
    max=100,
    value=25,
    size=200,
    showCurrentValue=True,
    units='%',
    labelPosition='bottom',
    label={
        'label': 'Female',
        'style': {
            'color': Colors.text,
            'fontSize': 14
        }
    }
)

【问题讨论】:

  • 你能贴一张你的实际情节的照片吗?
  • 将图像添加为 [链接] (i.stack.imgur.com/QvUPq.png) - 仍然是新的,因此无法嵌入图像
  • 只需复制图像并将其粘贴到您的帖子中,就这么简单!
  • 所以你想要this 之类的东西?
  • 成功了,谢谢!我还没有考虑到这一点

标签: python plotly-dash


【解决方案1】:

尝试负边距:

import dash_daq as daq

daq.Gauge(
    style={
        'color': Colors.text,

        'margin-bottom': -50 #Or whatever number suits your needs
    },
    min=0,
    max=100,
    value=25,
    size=200,
    showCurrentValue=True,
    units='%',
    labelPosition='bottom',
    label={
        'label': 'Female',
        'style': {
            'color': Colors.text,
            'fontSize': 14
        }
    }
)

【讨论】:

    猜你喜欢
    • 2020-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-17
    • 2021-03-16
    • 1970-01-01
    • 1970-01-01
    • 2020-03-11
    相关资源
    最近更新 更多