Funnel.add() 方法签名
add(name, attr, value,
funnel_sort="ascending", funnel_gap=0, **kwargs)
name -> str
图例名称
attr -> list
属性名称
value -> list
属性所对应的值
funnel_sort -> str/func
数据排序, 可以取 'ascending','descending','none'(表示按 data 顺序,即不排序)。
funnel_gap- > int
数据图形间距。默认为 0。
标签显示在内部
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()
标签显示在外部
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.render()
数据按升序排序
funnel = Funnel("漏斗图示例", width=600, height=400, title_pos='center')
funnel.add(
"商品",
CLOTHES,
prices,
is_label_show=True,
label_pos="inside",
label_text_color="#fff",
funnel_sort="ascending"
)
funnel.render()
指定图形间隔
funnel = Funnel("漏斗图示例", width=600, height=400, title_pos='center')
funnel.add(
"商品",
CLOTHES,
prices,
is_label_show=True,
label_pos="inside",
label_text_color="#fff",
funnel_sort="ascending",
funnel_gap=5,
)
funnel.render()