Ejemplo n.º 1
0
def create_Funnel():
    fl = pyecharts.Funnel("最低气温漏斗图",
                          "2018-40-16",
                          title_pos='left',
                          width=1400,
                          height=700)
    fl.add("最低气温",
           cities[:15],
           lows[:15],
           is_label_show=True,
           label_pos='inside',
           label_text_color='white')
    # fl.render("Funnel-low.html")
    page.add(fl)
Ejemplo n.º 2
0
def nation_hotspot_echart():

    fl = pyecharts.Funnel("主要城市热门景点数", "2020年6月18日 22:36:24", title_pos='left', width=1400, height=700)
    fl.add("景点数", add_key, add_value, is_label_show=True, label_formatter='{b}{c}', label_pos='outside')
    fl.render('nation_hotspot_echart.html')
Ejemplo n.º 3
0
# attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
# v1 = [5, 20, 36, 10, 75, 90]
# v2 = [10, 25, 8, 60, 20, 80]
# bar = pch.Bar("柱状图数据堆叠示例")
# bar.add("商家A", attr, v1, is_stack=True)
# bar.add("商家B", attr, v2, is_stack=True)
# bar.render(r'E:\python\test.html')

# v1 = [10, 20, 30, 40, 50, 60]
# v2 = [25, 20, 15, 10, 60, 33]
# es = pch.EffectScatter('动态散点图示例')
# es.add("资产负债散点图", v1, v2, is_label_show=True, symbol_size=26, symbol='pin', effect_scale=2, effect_brushtype='stroke', effect_period=10)
# es.render(r'E:\python\test.html')

attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 10, 75, 90]
v2 = [10, 25, 8, 60, 20, 80]
v3 = [i + j for i, j in zip(v1, v2)]
funn = pch.Funnel('漏斗图示例')
funn.add("商品",
         attr,
         v3,
         is_label_show=True,
         is_legend_show=True,
         funnel_sort='ascending',
         label_pos='outside',
         label_text_color='#2B2B2B',
         legend_orient='vertical',
         legend_pos='left')
funn.render(r'E:\python\test.html')
Ejemplo n.º 4
0
'''--------------------(四)漏斗图--------------------------------------'''
# 从pyecharts包中导出创建漏斗图的函数
import pandas as pd
from pyecharts as pec

# 1.导入创建漏斗图所需要的数据
#从浏览到购买的各环节转化率
df = pd.read_csv('E:/实习/userbehavior/漏斗数据.csv', encoding='utf-8',header=None,index_col=None)#列标题导入出错时处理办法
columns=['环节','数量','转化率']
df.columns=columns
attr1 = df['环节']
values1 = df['转化率']
print(attr1)
print(values1)
funnel1 = pec.Funnel('漏斗图')
funnel1.add(name='环节',  # 指定图例名称
            attr=attr1,  # 指定属性名称
            value=values1,  # 指定属性所对应的值
            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')  # 指定图例的位置

funnel1.render(r'./funnel1.html') 

##2.独立访客转化漏斗