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 = [
"高等数学1,2",
"C语言程序设计",
"python程序设计",
"大数据导论",
"数据结构",
"大数据与人工智能",
]
y_data = [100, 80, 60, 40, 20,30]
data = [[x_data[i], y_data[i]] for i in range(len(x_data))]
(
Funnel()
.add(
series_name="",
data_pair=data,
gap=2,
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="学习比例"))
.render("funnel_chart.html")
)