zoukankan      html  css  js  c++  java
  • 数据可视化旭日图

    from pyecharts.globals import CurrentConfig, NotebookType
     
    CurrentConfig.NOTEBOOK_TYPE = NotebookType.JUPYTER_LAB
     
    from pyecharts import options as opts
    from pyecharts.charts import Sunburst
     
     
    def sunburst():
        data = [
            opts.SunburstItem(
                name="爷爷",
                children=[
                    opts.SunburstItem(
                        name="李叔叔",
                        value=15,
                        children=[
                            opts.SunburstItem(name="表妹李师师", value=2),
                            opts.SunburstItem(
                                name="表哥李振",
                                value=5,
                                children=[opts.SunburstItem(name="表侄李加", value=2)],
                            ),
                            opts.SunburstItem(name="表姐李丝", value=4),
                        ],
                    ),
                    opts.SunburstItem(
                        name="爸爸",
                        value=10,
                        children=[
                            opts.SunburstItem(name="", value=5),
                            opts.SunburstItem(name="哥哥李梅", value=1),
                        ],
                    ),
                ],
            ),
            opts.SunburstItem(
                name="三爷爷",
                children=[
                    opts.SunburstItem(name="李叔叔",
                                      children=[
                                          opts.SunburstItem(name="表哥李靖", value=1),
                                          opts.SunburstItem(name="表妹李静", value=2),
                                      ],
                                      )
                ],
            ),
        ]
     
        c=(
            Sunburst()
                .add(series_name="家庭树旭日图", data_pair=data, radius=[0, "90%"])
                .set_global_opts(title_opts=opts.TitleOpts(title="家庭旭日图"),
                                 toolbox_opts=opts.ToolboxOpts())
                .set_series_opts(lable_opts=opts.LabelOpts(formatter="{b}"))
        )
        return c
     
     
    sunburst().load_javascript()
    sunburst().render('mm.html')
  • 相关阅读:
    性能测试相关
    centos7 设置定时器 crond
    大杀器Bitset
    树形DP
    双线程DP
    状态压缩DP
    斜率优化DP
    01分数规划
    二分和三分
    uva11549 Floyd判圈法
  • 原文地址:https://www.cnblogs.com/jgua/p/15642797.html
Copyright © 2011-2022 走看看