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')
  • 相关阅读:
    用webservice实现的一个天气预报程序
    让VS.net2005手机模拟器上网
    EVC4.0 PPC2003 Emulator 转中文版
    BSTR转CString
    在pocket pc 2003上播放声音
    VC++.net 2005 SmartDevice 屏幕转向
    c#.net2005 调用evc4.0生成的dll文件
    Json
    adb 命令模拟按键事件
    bat 截取字符
  • 原文地址:https://www.cnblogs.com/jgua/p/15642797.html
Copyright © 2011-2022 走看看