def test_funnel(): # funnel_0 attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value = [20, 40, 60, 80, 100, 120] funnel = Funnel("漏斗图示例") funnel.add("商品", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render() # funnel_1 funnel = Funnel("漏斗图示例", width=600, height=400, title_pos='center') funnel.add("商品", attr, value, is_label_show=True, label_pos="outside", legend_orient='vertical', legend_pos='left') funnel.show_config() funnel.render()
def get_salary(self, df): money = df["薪资"].apply(lambda x: np.array( x.replace("k", "").replace("K", "").split("-")).tolist()) money = money.apply(lambda x: (int(x[0]) + int(x[1])) / 2) # 重新分类薪资区间范围 df["薪资"] = pd.cut( money, bins=[0, 10, 20, 25, 30, 100], right=False, labels=np.array(["0-10k", "10k-20k", "20k-25k", "25k-30k", "30K+"])) data = df["薪资"].value_counts() funnel = Funnel("工程师薪资分布图", title_pos="center") funnel.add( name="薪资分布", attr=data.index, value=data.values, is_label_show=True, label_formatter='{b} {d}%', label_pos='inside', legend_orient='vertical', legend_pos='right', ) funnel.render(self.html_path + "salary.html") draw_pie(self.html_path + "salaryPie.html", "薪资分布", data.index, data.values)
def funnel_orientataion(self): orientation = pd.read_csv(self.all_house_path, encoding='utf-8') orientation = orientation.groupby(by='orientation').count() orientation = orientation['price'].sort_values(ascending=False) attr = orientation.index value = orientation.values index = [] values = [] for i in attr: index.append(i) for i in value: values.append(i) # print(len(index), len(value)) funnel_orien = Funnel("房源朝向漏斗图", width=800, height=700, title_pos="center") funnel_orien.add( "朝向", attr, value, is_label_show=True, label_pos="outside", legend_pos="left", label_text_color="#000", legend_orient="vertical", funnel_gap=5, ) funnel_orien.render(path="funnel-orientataion.html")
def dan_wang(self): """ 获取淡旺季电影 :return: """ pro = self.get_pro() month_l = [] amount_l = [] for month in self.month_list: df = pro.bo_monthly(date=month) month_amount = df['month_amount'].sum() mon = f"{month[4:6]}月份" month_l.append(mon) amount_l.append(month_amount) funnel = Funnel("") funnel.add( "商品", month_l, amount_l, is_label_show=True, label_pos="inside", label_text_color="#fff", ) funnel.render(path="淡旺季.html", )
def loudoutu(): '''漏斗图''' attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value = [20, 40, 60, 80, 100, 120] funnel = Funnel("漏斗图示例") funnel.add("商品", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render('./info/漏斗图.html')
def drawFunnel(title, data, savepath='./results'): if not os.path.exists(savepath): os.mkdir(savepath) funnel = Funnel(title, title_pos='center') funnel.use_theme('chalk') attrs = [i for i, j in data.items()] values = [j for i, j in data.items()] funnel.add("", attrs, values, is_label_show=True, label_pos="inside", label_text_color="#fff", legend_pos="left", legend_orient="vertical") funnel.render(os.path.join(savepath, '%s.html' % title))
def test_funnel_labelpos_inside(): funnel = Funnel("漏斗图示例") funnel.add("商品", CLOTHES, prices, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render()
def test_funnel_other_style(): funnel = Funnel("漏斗图示例", title_pos='center') funnel.add("商品", CLOTHES, prices, is_label_show=True, label_pos="outside", legend_orient='vertical', legend_pos='left') funnel.render()
def test_funnel_labelpos_inside(): funnel = Funnel("漏斗图示例") funnel.add( "商品", CLOTHES, prices, is_label_show=True, label_pos="inside", label_text_color="#fff", ) funnel.render()
def draw_edu_funnel(data): funnel = Funnel("妹子学历分布漏斗图", title_top='center') funnel.add("学历", edu_interval, data, is_label_show=True, label_pos="inside", label_text_color="#fff", is_random=True) funnel.render() return funnel
def draw_funnel(): attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value = [20, 40, 60, 80, 100, 120] funnel = Funnel("漏斗图示例") funnel.add("商品", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render()
def test_funnel_other_style(): funnel = Funnel("漏斗图示例", title_pos="center") funnel.add( "商品", CLOTHES, prices, is_label_show=True, label_pos="outside", legend_orient="vertical", legend_pos="left", ) funnel.render()
def countFinalWordsList(text, new_text): new_words = new_text.split(' ') countvaluelist = [] for i in new_words: #print i count = text.count(i) countvaluelist.append(count) funnel = Funnel("论坛评论词云统计图", width=900, height=700, title_pos='center') funnel.add("论坛评论词云统计", new_words, countvaluelist, is_label_show=True, label_pos="inside", label_text_color="#fff", funnel_sort="escending") funnel.render(r'../templates/ciyuncountwords.html')
def get_top_skill(self,funnel_num=9): jieba.load_userdict('D:/编程练习题/datasite/test/analysis/user_dict.txt') unuse_keywords = ['开发', '工程师', ')', '(', ' ', '(', ')', '高级', '编号', '.', ':', '/', ':', '-', '职位', '+', '、', ',', '实习生', '..', '*', '_', '[', ']', '东莞', '3', '2', '二', '01', ',', ',', '2020', '一', '\\', '8k', '呼和浩特', '内蒙古', '07', 'ZHGAly' , 'J11797', '04', '05', '03', 'J11797', 'ZHGAljw', 'J11959', 'J12619', '对', '003', '002', '苏州', '&', '02', '.', '急聘', '应届生', '实习生', '月', '日' , '初级', '高级', '区域', '资深', '岗', '10', '实习', '五险一金', '讯飞', '大', '12K', '8K', '可', '双休', '出差', '平台', '福州', '方向', '北京', '推广' , '中级', '助理', '千', '总监', '客服', '客户', '省区', '与', '驻场', '合伙人', '商务', '专家', '讲师', '#', 'J11804', '年薪', '上市公司', '10W', '锁' , '员', '休闲', '娱乐', '医疗', '现场', '公安', '政府', '底薪', '负责人', '人事', '老师' , '五险', '一金', '重庆', '高新', '毕业生', '应届', '编程', '包', '合肥', '长期', '咨询', '师', '售后' , '小', '年', '程序员', 'RJ002', '号', '001', '个', '郑州', '武汉', '万', '招聘', '代表', '渠道', '4', '6', 'S', 'Y', '7', '5', '不' , '急', '++', '西安'] d = {} sql = 'select title,number from job' self.db.cursor.execute(sql) result = self.db.cursor.fetchall() for r in result: tmp = jieba.lcut(r[0]) for skill in tmp: if skill in unuse_keywords: continue if skill == '软件工程师': skill = '软件开发' if skill not in d.keys(): d[skill] = 0 d[skill] += int(r[1]) wordcloud = WordCloud(width=1000, height=600) wordcloud.add("", d.keys(), d.values(), word_size_range=[20, 100]) wordcloud.render(path="D:/编程练习题/datasite/test/templates/charts/wordcloud.html") d_order = sorted(d.items(), key=lambda x: x[1], reverse=True) d_order=dict(d_order[0:funnel_num]) configure(output_image=True) funnel = Funnel(background_color='white', title_text_size=20, title_pos='center',width=1000, height=600) funnel.add('教育', d_order.keys(), d_order.values(), is_label_show=True, label_pos='inside', is_legend_show=False) funnel.render(path='D:/编程练习题/datasite/test/templates/charts/career_funnel.html')
def test_funnel(): # label_pos 'inside' attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value = [20, 40, 60, 80, 100, 120] funnel = Funnel("漏斗图示例") funnel.add("商品", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render() # label_pos 'outside'&legend_orient 'vertical' funnel = Funnel("漏斗图示例", title_pos='center') funnel.add("商品", attr, value, is_label_show=True, label_pos="outside", legend_orient='vertical', legend_pos='left') funnel.render()
def LouDou_2017(request): number = Area_gdp.objects.get(year=2017) attr = [ "北京", "天津", "河北", "山西", "内蒙古", "辽宁", "吉林", "黑龙江", "上海", "江苏", "浙江", "安徽", "福建", "江西", "山东", "河南", "湖北", "湖南", "广东", "广西", "海南", "重庆", "四川", "贵州", "云南", "西藏", "陕西", "甘肃", "青海", "宁夏", "新疆" ] value = [ number.beijing, number.tianjin, number.hebei, number.shanxi, number.neimenggu, number.liaoning, number.jilin, number.heilongjiang, number.shanghai, number.jiangsu, number.zhejiang, number.anhui, number.fujian, number.jiangxi, number.shandong, number.henan, number.hubei, number.hunan, number.guangdong, number.guangxi, number.hainan, number.chongqing, number.sichuan, number.guizhou, number.yunnan, number.xizang, number.shanxi, number.gansu, number.qinghai, number.ningxia, number.xinjiang ] funnel = Funnel("2017年地区经济数据分析", width=1500, height=600, title_pos='center') funnel.add( "GDP", attr, value, is_label_show=True, label_pos="outside", label_text_color="#fff", funnel_sort="ascending", # funnel_gap=5, legend_orient="vertical", legend_pos="left", ) funnel.render( path="F:/尚世康资料/尚世康+毕业论文相关资料/系统设计/cms/templates/2017年地区经济桶状图.html") return HttpResponse("2017年桶装图已生成")
plt.show()''' #(四)漏斗分析-流失率 data_user_count = data_user.groupby('behavior_type')['behavior_type'].count() pv_all = data_user['user_id'].count() print(data_user_count) print("总浏览量:",pv_all) print('总浏览量—点击量 流失率: {:.2f}'.format((pv_all-502835)/pv_all)) print("点击量-加入购物车量 流失率:{:.2f}".format((502835-10756)/502835)) print("加入购物车量-收藏量 流失率:{:.2f}".format((10756-14896)/10756)) print("收藏量-购买量 流失率:{:.2f}".format((14896-5195)/14896)) from pyecharts import Funnel funnel = Funnel("漏斗分析", width=600, height=400, title_pos='center') funnel.add("用户行为数据", ['点击','收藏','加入购物车','支付'],[502835,10756,14896,5195], is_label_show=True,label_formatter='{b} {c}',label_pos="outside",legend_orient='vertical', legend_pos='left') funnel.render('E:/python/data/user_behavior_analysis_tb/data.html') # (五)用户价值度分析 from datetime import datetime datenow = datetime(2014,12,20) # 计算每位用户最近购买时间 recent_buy_time = data_user[data_user.behavior_type==4].groupby('user_id')\ .date.apply(lambda x:datetime(2014,12,20)-x.sort_values().iloc[-1])\ .reset_index().rename(columns={'date':'recent'}) recent_buy_time.recent = recent_buy_time.recent.map(lambda x:x.days) # 计算每位用户消费频率 buy_freq = data_user[data_user.behavior_type==4].groupby('user_id').date.count().\ reset_index().rename(columns={'date':'freq'}) # 将最近购买时间和消费频率合并在一起 rfm = pd.merge(recent_buy_time,buy_freq,left_on='user_id',right_on='user_id',how='outer') # 将各维度分成3级,得数越高越好
# -*- coding: utf-8 -*- """ Created on Thu Aug 10 18:07:30 2017 @author: 17549 """ from pyecharts import Funnel attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value = [20, 40, 60, 80, 100, 120] funnel = Funnel("动态漏图", width=600, height=400, title_pos='center') funnel.add("商品", attr, value, is_label_show=True, label_pos="outside", legend_orient='vertical', legend_pos='left') funnel.show_config() funnel.render(r"E:\12_动态漏图升级.html")
radar.add("预算分配", v1, is_splitline=True, is_axisline_show=True, symbol=None, area_color=RGB(255, 120, 0), item_color=RGB(255, 120, 0), is_area_show=True, area_opacity=0.5) radar.add("实际开销", v2, symbol=None, area_color=RGB(50, 50, 0), item_color=RGB(50, 50, 0), is_area_show=True, area_opacity=0.5) radar.render() #------------------------------------------------------------------------------ # Funnel attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value = [1, 11, 15, 30, 45, 101] funnel = Funnel("漏斗图示例") funnel.add("商品", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render('funnel.html') # ---------------------------------------------------------------------------- # Gauge from pyecharts import Gauge,Liquid gauge = Gauge("仪表盘示例") gauge.add("业务指标", "完成率", 166.66, angle_range=[180, 0], scale_range=[0, 200], is_legend_show=False) gauge.render('Gauge.html') liquid = Liquid("水球图示例") liquid.add("Liquid", [0.6]) liquid.render()
from pyecharts import Funnel attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value = [20, 40, 60, 80, 100, 120] funnel = Funnel("漏斗图示例") funnel.add("商品", attr, value, is_label_show=True, label_pos='inside', label_text_color="#fff", is_more_utils=True) funnel.render(path="Funnel.html")
# -*- coding: utf-8 -*- """ Created on Thu Aug 10 17:53:52 2017 @author: 17549 """ from pyecharts import Funnel attr=["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] value=[20,40,60,80,100,120] funnel=Funnel("动态漏图") funnel.add("商品",attr,value,is_label_show=True,label_pos="inside",label_text_color="fff") funnel.show_config() funnel.render(r"E:\11_动态漏图.html")
def buy_convert_rate(self): # 浏览、收藏、加入购物车、购买的用户数 pv_num = self.data[self.data['behavior_type'] == 'pv']['user_id'].count() collect_num = self.data[self.data['behavior_type'] == 'collect']['user_id'].count() cart_num = self.data[self.data['behavior_type'] == 'cart']['user_id'].count() buy_num = self.data[self.data['behavior_type'] == 'buy']['user_id'].count() # 由于收藏和加入购物车都为浏览和购买阶段之间确定购买意向的用户行为,且不分先后顺序,因此将其算作一个阶段 far_num = collect_num + cart_num trend_map = {'环节': ['pv', 'far', 'buy'], '人数': [pv_num, far_num, buy_num]} frame = pd.DataFrame(trend_map) # 计算单环节转化率 tmp1 = np.array(frame['人数'][1:]) tmp2 = np.array(frame['人数'][0:-1]) single_convs = list(tmp1 / tmp2) single_convs.insert(0, 1) # 在开始处插入1,因为pv阶段是没有转化率的 single_convs = [round(x, 4) for x in single_convs] frame['单一环节转化率'] = single_convs # 绘制漏斗图 attrs = frame['环节'].tolist() attr_values = (np.array(frame['单一环节转化率'] * 100).tolist()) funnel = Funnel("单一环节转化漏斗图", width=400, height=200, title_pos='center') funnel.add(name="商品交易行环节", # 指定图例名称 attr=attrs, # 指定属性名称 value=attr_values, # 指定属性所对应的值 is_label_show=True, # 指定标签是否显示 label_formatter='{c}%', # 指定标签显示的格式 label_pos="inside", # 指定标签的位置 legend_orient='vertical', # 指定图例的方向 legend_pos='left', # 指定图例的位置 is_legend_show=True) # 指定图例是否显示 funnel.render('render.html') # 生成html文件 # 总体转化率 tmp3 = np.array(frame['人数']) tmp4 = np.ones(len(frame['人数'])) * frame['人数'][0] # [942230. 942230. 942230.] total_convs = list(tmp3 / tmp4) total_convs = [round(x, 4) for x in total_convs] frame['总体转化率'] = total_convs # 绘制漏斗图 attrs = frame['环节'].tolist() attr_values = (np.array(frame['总体转化率'] * 100).tolist()) funnel1 = Funnel("总体转化漏斗图", width=400, height=200, title_pos='center') funnel1.add(name="商品交易行环节", # 指定图例名称 attr=attrs, # 指定属性名称 value=attr_values, # 指定属性所对应的值 is_label_show=True, # 指定标签是否显示 label_formatter='{c}%', # 指定标签显示的格式 label_pos="inside", # 指定标签的位置 legend_orient='vertical', # 指定图例的方向 legend_pos='left', # 指定图例的位置 is_legend_show=True) # 指定图例是否显示 funnel1.render('render1.html') # 生成html文件
sqlDF = spark.sql( "SELECT count(pv) as cpv, count(cart) as ccart, count(fav) as cfav, count(buy) as cbuy from pbcf" ) sqlDF.show() pbcfPandasDF = sqlDF.toPandas() # Python实现漏斗图的绘制 https://blog.csdn.net/qq_41080850/article/details/83933017 from pyecharts import Funnel attrs = pd.Series(['pv', 'cart', 'fav', 'buy']).tolist() attr_value = pd.Series([ 100, pbcfPandasDF.iloc[0]['ccart'] / pbcfPandasDF.iloc[0]['cpv'] * 100, pbcfPandasDF.iloc[0]['cfav'] / pbcfPandasDF.iloc[0]['ccart'] * 100, pbcfPandasDF.iloc[0]['cbuy'] / pbcfPandasDF.iloc[0]['ccart'] * 100 ]).tolist() funnel1 = Funnel("总体转化漏斗图一", width=800, height=400, title_pos='center') funnel1.add( name="商品交易行环节", # 指定图例名称 attr=attrs, # 指定属性名称 value=attr_value, # 指定属性所对应的值 is_label_show=True, # 指定标签是否显示 label_formatter='{c}%', # 指定标签显示的格式 label_pos="inside", # 指定标签的位置 legend_orient='vertical', # 指定图例的方向 legend_pos='left', # 指定图例的位置 is_legend_show=True) # 指定图例是否显示 funnel1.render() funnel1 spark.catalog.clearCache() spark.stop()
values = data_zhl.总体转化率 funnel0 = Funnel('总体转化漏斗图', title_pos='center', width=2000, height=900) funnel0.add( name='环节', # 指定图例名称 attr=attr, # 指定属性名称 value=values, # 指定属性所对应的值 is_label_show=True, # 确认显示标签 label_formatter='{c}' + '%', # 指定标签显示的方式 legend_top='bottom', # 指定图例位置,为避免遮盖选择右下展示 # pyecharts包的文档中指出,当label_formatter='{d}'时,标签以百分比的形式显示. # 但我这样做的时候,发现显示的百分比与原始数据对应不上,只好用上面那种显示形式 label_pos='outside', # 指定标签的位置,inside,outside legend_orient='vertical', # 指定图例显示的方向 legend_pos='right') # 指定图例的位置 funnel0.render("转化漏斗.html") ##pyecharts仓网覆盖连线 path = u"D:/物料专配/2.0/8.25版/4、7、10仓结果/C_Network_10_0826.csv" data_pyfugai = pd.read_csv(open(path)) #获取RDC仓位置和城市经纬度坐标点 RDC_cords = { data_pyfugai.iloc[i]['RDC_NAME']: [data_pyfugai.iloc[i]['RDC_LGT'], data_pyfugai.iloc[i]['RDC_LAT']] for i in range(len(data_pyfugai)) } City_cords = { data_pyfugai.iloc[i]['CUSTOMER_NAME']: [ data_pyfugai.iloc[i]['CUSTOMER_LGT'], data_pyfugai.iloc[i]['CUSTOMER_LAT'] ]
Line3D.render('E:\\pye\\line3d.html') # 在指定目录下生成文件 #coding:utf-8 from pyecharts import Gauge # 仪表盘 gauge = Gauge('项目完成进度') gauge.add('进度表', '完成率', 88.88) gauge.render('E:\\pye\\gauge.html') # 在指定目录下生成文件 #coding:utf-8 from pyecharts import Funnel # 漏斗图 attr = ['认知', '了解', '认可', '考虑', '意向', '购买'] value = [120, 100, 80, 60, 40, 20] funnel = Funnel('客户购买分析图') funnel.add('买车', attr, value, is_label_show=True, label_pos='inside', label_text_color='#fff') funnel.render('E:\\pye\\funel.html') # 在指定目录下生成文件 #coding:utf-8 from pyecharts import Liquid liquid = Liquid("水球图") liquid.add("Liquid", [0.8]) liquid.show_config() liquid.render('E:\\pye\\sq.html') # 在指定目录下生成文件
from pyecharts import Funnel, Gauge, Graph attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] v1 = [5, 20, 36, 56, 78, 100] v2 = [55, 60, 16, 20, 15, 80] # 漏斗图 funnel = Funnel('漏斗图') funnel.add('商品', attr, v1, is_label_show=True, label_pos='inside', label_text_color="#fff") funnel.show_config() funnel.render(path="./data/02-01漏斗图.html") # 仪表盘 gauge = Gauge("仪表盘") gauge.add('业务指标', '完成率', 66.66) gauge.show_config() gauge.render(path="./data/02-02仪表盘.html") # 关系图 nodes = [{ "name": "结点1", "symbolSize": 10 }, { "name": "结点2", "symbolSize": 20 }, {
visual_range=[0, 1000], maptype='china', symbol_size=8, effect_scale=5, is_visualmap=True) geo.render('大数据城市需求分布图.html') def get_experience(list): experience2 = {} for i in set(list): experience2[i] = list.count(i) return experience2 dir3 = get_experience(experience) #print(dir3) attr3 = dir3.keys() value3 = dir3.values() funnel = Funnel("工作经验漏斗图", title_pos='center') funnel.add("", attr3, value3, is_label_show=True, label_pos="inside", label_text_color="#fff", legend_orient='vertical', legend_pos='left') funnel.render('工作经验要求漏斗图.html')
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> # Part 5 Create Funnel with Pyecharts >>> from pyecharts import Funnel >>> attr=["potential","contact","interested","intention","engaged","negotiation","deal"] >>> value=[140,120,100,80,60,40,20] >>> funnel=Funnel("CBAF") # CBAF means customer behaviour analysis funnel >>> funnel.add("CBAF",attr,value,is_label_show=True,label_pos="inside",label_text_color="#fff") <pyecharts.charts.funnel.Funnel object at 0x03727910> >>> funnel.render() >>>
#encoding=utf-8 from pyecharts import Funnel attr =["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value =[20, 40, 60, 80, 100, 120] funnel =Funnel("漏斗图示例") funnel.add("商品", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render()
gu = Gauge("仪表盘图") gu.add("指标", "达标", 85) gu.render("Guage-eg.html") # 导入饼图Pie # 设置主标题与副标题,标题设置居中,设置宽度为900 pie = Pie("饼状图", "一年的降水量与蒸发量", title_pos='center', width=900) # 加入数据,设置坐标位置为【25,50】,上方的colums选项取消显示 pie.add("降水量", columns, data1, center=[25, 50], is_legend_show=True) # 加入数据,设置坐标位置为【75,50】,上方的colums选项取消显示,显示label标签 pie.add("蒸发量", columns, data2, center=[75, 50], is_legend_show=False, is_label_show=True) # 保存图表 pie.render("pie.html") # 漏斗图+图片 attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] value = [20, 40, 60, 80, 100, 120] funnel = Funnel("漏斗图示例") funnel.add("商品", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render(path='./漏斗图01.png')
from pyecharts import Funnel #选项 attr = ["美女", '房子', '车子', '事业', '家人', '娱乐', '数码产品'] #权重 value = [150, 100, 80, 120, 140, 90, 70] #新建一个漏斗图 funnel = Funnel("男人心漏斗图") # 数据 权重 边缘标签 中间标签 funnel.add("因素", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff") funnel.render(r'C:\Users\Administrator\Desktop\数据可视化\pyecharts\html\8.html')
import json from pyecharts import Funnel f = open("E:/Data/practice/pies.json") data = json.load(f) name = data['name'] sales = data['sales'] sales_volume = data['sales_volume'] # 漏斗图.这里传入空字符串即可没有titile funnel = Funnel("", width=800) # label_pos='inside'指明标签的位置在图的内部,label_text_color='#fff'指明标签自己颜色为白色 funnel.add("成交量", name, sales_volume, is_label_show=True, label_pos='inside', label_text_color='#fff') funnel.render("./funnel.html")