微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Plotly Dash:将指标标题放在数字的左侧

如何解决Plotly Dash:将指标标题放在数字的左侧

我想用 Plotly 指标 bullet-style (number+gauge) 和 number-only 在对齐的行中显示不同的值Dash 应用程序。

不幸的是,我找不到将数字-only 指示器的标题定位在显示数字左侧的方法。 有没有办法把标题移到左边?

(我尝试将 'align': 'left' 添加标题字典中,但这只会对齐文本但不会改变位置。)

这是一个例子:

import plotly.graph_objects as go

bullet_fig1 = go.figure(go.Indicator(
    mode = "number+gauge",value = 23,align = "left",domain = {'x': [0.25,1],'y': [0.45,.95]},number = {
        'suffix': " %",},title = {'text': "Load 1",'font': {"size": 12},gauge = {
        'shape': "bullet",'axis': {'range': [0,100]},'bar': {
            'color': "red",'thickness': .7,))
bullet_fig1.update_layout(height = 50,margin = {'t':0,'b':0,'l':0,'r':0})

bullet_fig2 = go.figure(go.Indicator(
    mode = "number+gauge",value = 46,title = {'text': "Load 2",))
bullet_fig2.update_layout(height = 50,'r':0})

number_fig = go.figure(go.Indicator(
    mode = "number",value = 12,number = {
        'suffix': " °C",title = {'text': "Temperature",))
number_fig.update_layout(height = 50,'r':0})


bullet_fig1.show()
bullet_fig2.show()
number_fig.show()

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。