pyecharts-漏斗图

pyecharts
echarts

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

"""
Gallery 使用 pyecharts 1.1.0
参考地址: https://echarts.apache.org/examples/editor.html?c=funnel

目前无法实现的功能:

1、暂时无法对漏斗图的长宽等范围操作进行修改
"""
x_data = ["展现", "点击", "访问", "咨询", "订单"]
y_data = [100, 80, 60, 40, 20]

data = [[x_data[i], y_data[i]] for i in range(len(x_data))]

funnel=(
    Funnel(init_opts=opts.InitOpts(width="600px", height="400px"))
    .add(
        series_name="漏斗转化率",
        data_pair=data,            #  数据集,list
        gap=12,                        #  漏斗每一层级间距
        tooltip_opts=opts.TooltipOpts(trigger="item", formatter="{a} <br/>{b} : {c}%"),
        label_opts=opts.LabelOpts(is_show=True, position="inside"),
        itemstyle_opts=opts.ItemStyleOpts(border_color="#fff", border_width=1),
    )
    .set_global_opts(title_opts=opts.TitleOpts(title="漏斗图", subtitle="总体转化率"))
#     .render("funnel_chart.html")
)
funnel.render_notebook()

pyecharts-漏斗图

上一篇:绘制仪表盘


下一篇:pyecharts最新版本安装(V1版本)