基本图表 - pyecharts - A Python Echarts Plotting Library built with love.
from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.faker import Faker
c = (
Pie()
.add(
"",
[list(z) for z in zip(["7室1厅", "5室3厅", "5室2厅", "4室2厅", "4室1厅", "3室2厅", "3室1厅", "2室2厅", "2室1厅", "1室1厅", "1室0厅"], [1, 3, 10, 19, 7, 39, 8, 14, 12, 9, 6])],
radius=["40%", "55%"],
label_opts=opts.LabelOpts(
position="outside",
formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c} {per|{d}%} ",
background_color="#eee",
border_color="#aaa",
border_width=1,
border_radius=4,
rich={
"a": {"color": "#999", "lineHeight": 22, "align": "center"},
"abg": {
"backgroundColor": "#e3e3e3",
"width": "100%",
"align": "right",
"height": 22,
"borderRadius": [4, 4, 0, 0],
},
"hr": {
"borderColor": "#aaa",
"width": "100%",
"borderWidth": 0.5,
"height": 0,
},
"b": {"fontSize": 16, "lineHeight": 33},
"per": {
"color": "#eee",
"backgroundColor": "#334455",
"padding": [2, 4],
"borderRadius": 2,
},
},
),
)
# .set_global_opts(title_opts=opts.TitleOpts(title="竹子林户型"))
.render("竹子林户型.html")
)