• Funnel:漏斗图


    
    Funnel:漏斗图
    class pyecharts.charts.Funnel
    
    class Funnel(
        # 初始化配置项,参考 `global_options.InitOpts`
        init_opts: opts.InitOpts = opts.InitOpts()
    )
    func pyecharts.charts.Funnel.add
    
    def add(
        # 系列名称,用于 tooltip 的显示,legend 的图例筛选。
        series_name: str,
    
        # 系列数据项,格式为 [(key1, value1), (key2, value2)]
        data_pair: Sequence,
    
        # 是否选中图例
        is_selected: bool = True,
    
        # 系列 label 颜色
        color: Optional[str] = None,
    
        # 数据排序, 可以取 'ascending','descending','none'(表示按 data 顺序)
        sort_: str = "descending",
    
        # 数据图形间距
        gap: Numeric = 0,
    
        # 标签配置项,参考 `series_options.LabelOpts`
        label_opts: Union[opts.LabelOpts, dict] = opts.LabelOpts(),
    
        # 提示框组件配置项,参考 `series_options.TooltipOpts`
        tooltip_opts: Union[opts.TooltipOpts, dict, None] = None,
    
        # 图元样式配置项,参考 `series_options.ItemStyleOpts`
        itemstyle_opts: Union[opts.ItemStyleOpts, dict, None] = None,
    )
    
    
    
    def funnel_label_inside() -> Funnel:
        c = (
            Funnel()
            .add(
                "商品",
                [list(z) for z in zip(Faker.choose(), Faker.values())],
                label_opts=opts.LabelOpts(position="inside"),
            )
            .set_global_opts(title_opts=opts.TitleOpts(title="Funnel-Label(inside)"))
        )
        return c
    	
    	
    # 系列数据项,格式为 [(key1, value1), (key2, value2)]
    	
    node2:/root/fenxi#cat k13.py 
    import datetime
    import random
    
    from pyecharts import options as opts
    from pyecharts.charts import Calendar
    from pyecharts.charts import Funnel, Page
    from pyecharts.faker import Faker
    
    def funnel_label_inside() -> Funnel:
        c = (
            Funnel()
            .add(
                "商品",
                [('蛋糕',100),('饮料',80),('香烟',60),('瓜子',50)],
                label_opts=opts.LabelOpts(position="inside"),
            )
            .set_global_opts(title_opts=opts.TitleOpts(title="Funnel-Label(inside)"))
        )
        return c
    
    
    funnel_label_inside().render("k13.html")	
  • 相关阅读:
    tornado之运行第一个tornado程序
    Django之QuerySet 查询
    openstack之路:KVM/Libvirt 安装
    【原创】Linux基础之SSH隧道/端口转发
    【原创】运维基础之keepalived
    【原创】数据库基础之Mysql(2)主从库配置
    【原创】Linux基础之iptables
    【原创】大叔经验分享(28)ELK分析nginx日志
    【原创】算法基础之Anaconda(1)简介、安装、使用
    【原创】大数据基础之Airflow(1)简介、安装、使用
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348632.html
Copyright © 2020-2023  润新知