Skip to content

Latest commit

 

History

History
37 lines (31 loc) · 920 Bytes

treemap_base.md

File metadata and controls

37 lines (31 loc) · 920 Bytes

pyecharts 代码 / 效果

from pyecharts import options as opts
from pyecharts.charts import TreeMap

data = [
    {"value": 40, "name": "我是A"},
    {
        "value": 180,
        "name": "我是B",
        "children": [
            {
                "value": 76,
                "name": "我是B.children",
                "children": [
                    {"value": 12, "name": "我是B.children.a"},
                    {"value": 28, "name": "我是B.children.b"},
                    {"value": 20, "name": "我是B.children.c"},
                    {"value": 16, "name": "我是B.children.d"},
                ],
            }
        ],
    },
]

c = (
    TreeMap()
    .add("演示数据", data)
    .set_global_opts(title_opts=opts.TitleOpts(title="TreeMap-基本示例"))
    .render("treemap_base.html")
)
<iframe width="100%" height="800px" src="Treemap/treemap_base.html"></iframe>