绘制仪表盘

 1 //绘制仪表盘(有缺陷)
 2 from pyecharts.charts import Gauge
 3 c = Gauge()
 4 c.add("",[("完成率",66.5)])
 5 c.render_notebook()   #在当前页面输出
 6 
 7 //修改之后
 8 from pyecharts.charts import Gauge
 9 import pyecharts.options as opts
10 (
11     Gauge(init_opts=opts.InitOpts(width="700px",height="700px"))
12     .add(series_name="业务指标",data_pair=[["完成率",55.5]])
13     .set_global_opts(
14         legend_opts=opts.LegendOpts(is_show=False),
15         tooltip_opts=opts.TooltipOpts(is_show=True,formatter="{a} <br/>{b}:{c}%"),
16     )
17     .set_series_opts(
18         axisline_opts=opts.AxisLineOpts(
19             linestyle_opts=opts.LineStyleOpts(
20                 color=[[0.3,"#67e0e3"],[0.7,"#37a2da"],[1,"#fd666d"]],width=30
21             )
22         )
23     )
24     .render_notebook()
25 )

绘制仪表盘

 

上一篇:ERROR: Command errored out with exit status 1:安装pip3 install --user pyecharts==0.5.11失败问题总结


下一篇:pyecharts-漏斗图