Esempio n. 1
0
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))
Esempio n. 2
0
#读取停用词文件
stops=open(r'D:\BI大屏\去停用词.txt','r',encoding='UTF-8').read()
# 去停用词
tokens=[token for token in cun if token not in stops]
d={}
for i in tokens:
    d[i] = d.get(i,0) + 1

count_list = sorted(d.items(), key=lambda x:x[1], reverse=True)
count_list = count_list[:15]
keyword_list = [k[0] for k in count_list]
value_list = [k[1] for k in count_list]


funnel=Funnel(background_color='#404a59')    #修改标题位置 
funnel.use_theme("dark")    #修改图表主题 
funnel.add("",keyword_list,
           value_list,
           is_label_show=True,
           is_legend_show=False,
           label_pos="outside")   #是否显示标签、是否显示图例、标签位置 
funnel._option['series'][0]["top"]=70   #修改漏斗图上间隔 
funnel._option['series'][0]["bottom"]=20    #修改漏斗图下间隔 
funnel._option['series'][0]["left"]="5%"    #修改漏斗图左间隔 
funnel._option['series'][0]["width"]="90%"  #修改漏斗图宽度 
#funnel.render(r"D:\BI大屏\漏斗图.html")
page.add_chart(funnel,name="funnel") 

#=============================================================================

# 关系图