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()