水球图首先是动态的效果,像水流一样波动,所以看起来比较的舒服,一般用于业务里面的完成率,其实和之前的仪表盘有点类似,但是我个人绝对水球图更加的好,因为看起来比较的炫酷。
from pyecharts import options as opts from pyecharts.charts import Liquid from pyecharts.globals import SymbolType c = ( Liquid() .add("完成", [0.7, 0.3], is_outline_show=False, shape=SymbolType.DIAMOND) .set_global_opts(title_opts=opts.TitleOpts(title="业务完成率")) .render("菱形水球图.html") )
from pyecharts import options as opts from pyecharts.charts import Grid, Liquid from pyecharts.commons.utils import JsCode l1 = ( Liquid() .add("lq", [0.6, 0.7], center=["60%", "50%"]) .set_global_opts(title_opts=opts.TitleOpts(title="标题")) ) l2 = Liquid().add( "lq", [0.3], center=["25%", "50%"], label_opts=opts.LabelOpts( font_size=50, formatter=JsCode( """function (param) { return (Math.floor(param.value * 10000) / 100) + '%'; }""" ), position="inside", ), ) grid = Grid().add(l1, grid_opts=opts.GridOpts()).add(l2, grid_opts=opts.GridOpts()) grid.render("双水球图显示.html")
其实只需要变动一下参数即可,和最开始的那个差不多。
from pyecharts import options as opts from pyecharts.charts import Liquid from pyecharts.globals import SymbolType c = ( Liquid() .add("lq", [0.7, 0.7], is_outline_show=False, shape=SymbolType.RECT) .set_global_opts(title_opts=opts.TitleOpts(title="标题")) .render("正方形.html") )
from pyecharts import options as opts from pyecharts.charts import Liquid c = ( Liquid() .add("lq", [0.7, 0.7]) .set_global_opts(title_opts=opts.TitleOpts(title="圆球")) .render("圆球.html") )
from pyecharts import options as opts from pyecharts.charts import Liquid from pyecharts.commons.utils import JsCode c = ( Liquid() .add( "lq", [0.3254], label_opts=opts.LabelOpts( font_size=50, formatter=JsCode( """function (param) { return (Math.floor(param.value * 10000) / 100) + '%'; }""" ), position="inside", ), ) .set_global_opts(title_opts=opts.TitleOpts(title="标题")) .render("数据精度水球图.html") )
感觉这个颜色搭配还是不错的
from pyecharts import options as opts from pyecharts.charts import Liquid c = ( Liquid() .add("lq", [0.6, 0.7, 0.8], is_outline_show=False) .set_global_opts(title_opts=opts.TitleOpts(title="标题")) .render("无边框水球图.html") )
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
长按识别二维码并关注微信
更方便到期提醒、手机管理