【Pyecharts-学习笔记系列之Gauge(一)】

from pyecharts import options as opts
from pyecharts.charts import Gauge


c = (
        Gauge(init_opts=opts.InitOpts(width="400px", height="400px"))
            .add(series_name="库位利用率",
                data_pair=[["hello", 90]], # 设置表盘显示文字和指针指向
                radius="73%", #仪表盘半径,默认75%
                detail_label_opts=opts.LabelOpts(is_show=False), #是否显示540
                axisline_opts=opts.AxisLineOpts(
                    linestyle_opts=opts.LineStyleOpts(
                        color = [(0.2,'#00FF00'),(0.5,'#00CDCD'),(0.8,'#fd666d'),(1,'#FF66FF')], # 此处划分为四个区间
                        width=30, #仪表盘的条宽
                        type_ = 'solid', #线型'solid'(默认), 'dashed', 'dotted'
                        opacity = 1,  #填充色透明度
                    )
                    )
                 )
            .set_global_opts(title_opts=opts.TitleOpts(title='仪表图销售部年度销量',
                                                       subtitle = '林老头super',
                                                       title_textstyle_opts = opts.TextStyleOpts(color='#FFFF00',
                                                                                                 font_size=30,),
                                                       subtitle_textstyle_opts={'color':'#D3D3D3',
                                                                                'font_size':13,
                                                                                'pos_right':'2'},  # 属性名称需加引号'pos_right':'2'不起作用!
                                                       pos_left='left'), # 同时设置主副标题位置
            legend_opts=opts.LegendOpts(is_show=False),
            tooltip_opts=opts.TooltipOpts(is_show=True, formatter="{a} <br/>{b} : {c}%"),
            
        )
           .render("gauge_ex.html")
    )

效果如图:
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值