zoukankan      html  css  js  c++  java
  • L7-12 常用表格图(四)

    一、课堂导入

    上节课学习了制作了极坐标图和漏斗图,本节课将会学习制作更有趣的的图表。

    二、仪表盘

    1.概念

    仪表盘是模仿汽车速度表的一种图表,常用来反映预算完成率、收入增长率等比率性指标,通过仪表盘可清晰的反映前后数据的对比。

    2.制作仪表盘

    # 绘制仪表盘
    import pyecharts
    # 导入仪表盘Gauge模块
    from pyecharts.charts import Gauge
    from pyecharts import options as opts
    # 建立实例gauge
    gauge=Gauge()
    # 配置参数  # 图例名称 #完成率(这里不用书写成百分形式,直接写数值就好)
    gauge.add("",[("完成率",66.6)])
    gauge.set_global_opts(title_opts=opts.TitleOpts(title="仪表盘"))
    gauge.render("C:\Users\admin\Desktop\L7\drawing\gauge.html")

    三、雷达图

    1.概念

    雷达图又称为蜘蛛网图,将比较重要的项目集中显示在一个圆形的图表上,可清晰展示每个部分的基本特点。

    2.分类

    普通雷达图、高级雷达图

    3.制作普通雷达图

    import pyecharts
    from pyecharts.charts import Radar
    from pyecharts import options as opts
    radar=Radar()
    # add_schema是Radar下的一个函数,功能是对地图的参数与功能进行一些配置
    radar.add_schema(schema=[
    # 设置雷达图的项目名称及项目数据情况也可以用字典
                            # 指定展示的项目  参照数据      
        opts.RadarIndicatorItem(name="外观",max_=10),
        opts.RadarIndicatorItem(name="拍照",max_=10),
        opts.RadarIndicatorItem(name="屏幕",max_=10),
        opts.RadarIndicatorItem(name="性能",max_=10),
        opts.RadarIndicatorItem(name="系统",max_=10)
        ]
    )
    score1=[[8,8,8.5,9,7]]
    score2=[[7,9,7,8,7.5]]
    # # 添加系列名称及数据,指定线段颜色
    radar.add("小米",score1,color="blue")
    radar.add("华为",score2,color="red")
    # 系列配置项,可配置图元样式、文字样式、标签样式、点线样式等
    radar.set_series_opts(label_opts=opts.LabelOpts(is_show = False))
    radar.set_global_opts(title_opts=opts.TitleOpts(title="雷达图"))
    radar.render("C:\Users\admin\Desktop\L7\drawing\radar.html")

    4.制作高级雷达图

    import pyecharts
    from pyecharts.charts import Radar
    from pyecharts import options as opts
    radar=Radar()
    value1 =[ 
        [82, 58, 90, 1.77, 68, 33], 
        [74, 49, 77, 1.46, 48, 27], 
        [78, 55, 80, 1.29, 59, 29], 
        [267, 216, 280, 4.8, 108, 64], 
        [185, 127, 216, 2.52, 61, 27], 
        [39, 19, 38, 0.57, 31, 15], 
        [41, 11, 40, 0.43, 21, 7]
    ]
    value2 =[ 
        [109, 81, 121, 1.28, 68, 51], 
        [106, 77, 114, 1.07, 55, 51], 
        [89, 65, 78, 0.86, 51, 26], 
        [53, 33, 47, 0.64, 50, 17], 
        [80, 55, 80, 1.01, 75, 24], 
        [117, 81, 124, 1.03, 45, 24], 
        [99, 71, 142, 1.1, 62, 42]
    ]
    c_schema = [ 
        {"name": "AQI", "max": 300, "min": 5}, 
        {"name": "PM2.5", "max": 250, "min": 20}, 
        {"name": "PM10", "max": 300, "min": 5}, 
        {"name": "CO", "max": 5}, 
        {"name": "NO2", "max": 200}, 
        {"name": "SO2", "max": 100}, 
    ]
    radar.add_schema(schema=c_schema, shape="circle")
    radar.add("北京", value1, color="blue") 
    radar.add("上海", value2, color="red")
    radar.set_series_opts(label_opts=opts.LabelOpts(is_show=False)) 
    radar.set_global_opts(title_opts=opts.TitleOpts(title="空气质量"))
    radar.render("C:\Users\admin\Desktop\L7\drawing\radar1.html") 

    四、总结

    1.仪表盘是模仿汽车速度表的一种图表,常用来反映预算完成率、 收入增长率等比率性指标,通过仪表盘可清晰的反映前后数据的对比。

    2.雷达图又称为蜘蛛网图,将比较重要的项目集中显示在一个圆 形的图表上,可清晰展示每个部分的基本特点。

  • 相关阅读:
    问题 G: 艰难取舍(dp)
    算式
    问题 G: 背菜谱
    问题 B: 寻路
    问题 D: 数字变换(dfs)
    问题 D: 2的幂数
    问题 C: 幸运数字II(4,7)
    问题 D: 莱布尼茨三角形
    问题 E: 有理数树
    2020年秋高级软件工程”领跑衫“获奖感言
  • 原文地址:https://www.cnblogs.com/xiaoxiao-ya/p/12465316.html
Copyright © 2011-2022 走看看