Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 723 Bytes

148.md

File metadata and controls

28 lines (23 loc) · 723 Bytes
@author jackzhenguo
@desc
@tag
@version 
@date 2020/02/15
from pyecharts import options as opts
from pyecharts.charts import Pie
from random import randint

def pie_base() -> Pie:
    c = (
        Pie()
        .add("", [list(z) for z in zip(['宝马', '法拉利', '奔驰', '奥迪', '大众', '丰田', '特斯拉'],
                                       [randint(1, 20) for _ in range(7)])])
        .set_global_opts(title_opts=opts.TitleOpts(title="Pie-基本示例"))
        .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
    )
    return c

pie_base().render('./img/pie_pyecharts.html')   
[上一个例子](147.md) [下一个例子](149.md)