コード例 #1
0
# -*- codeing = utf-8 -*-
# @Time     : 11/3 9:59
# @Author   : River
# @File     : mycharts.py
# @Software : PyCharm

from pyecharts import Pie
from Include.commons.common import Common

if __name__ == '__main__':
    common = Common()
    results = common.queryData(
        """select count(*) from bra where bra_size like '%A' 
            union all select count(*) from bra where bra_size like '%B' 
            union all select count(*) from bra where bra_size like '%C' 
            union all select count(*) from bra where bra_size like '%D' 
            union all select count(*) from bra where bra_size like '%E' 
            union all select count(*) from bra where bra_size like '%F' 
            union all select count(*) from bra where bra_size like '%G'"""
    )  # 获取每个罩杯数量
    attr = ["A罩杯", 'G罩杯', "B罩杯", "C罩杯", "D罩杯", "E罩杯", "F罩杯"]
    v1 = [
        results[0][0], results[6][0], results[1][0], results[2][0],
        results[3][0], results[4][0], results[5][0]
    ]
    pie = Pie("内衣罩杯", width=1300, height=620)
    pie.add("", attr, v1, is_label_show=True)
    pie.render('size.html')
    print('success')

    results = common.queryData(
コード例 #2
0
# encoding: utf-8
# author zww

from pyecharts import Radar
from Include.commons.common import Common

if __name__ == '__main__':
    common = Common()
    results = common.queryData("select * from squad")  #获取四排战绩

    # 初始化雷达图
    schema = [("KD", 1.6), ("吃鸡率", 6), ("Top10", 45), ("场均伤害", 220),
              ("最多击杀", 9), ("爆头率", 35)]
    radar = Radar(width=1300, height=620)
    radar.config(schema)
    # 设置样例颜色
    range_color = [
        '#313695', '#a50026', '#74add1', '#fdae61', '#e0f3f8', '#ffffbf',
        '#fee090', '#f46d43'
    ]
    index = 0
    for result in results:
        data = [[
            str(result[3]),
            str(result[4]),
            str(result[5]),
            str(result[6]),
            str(result[8]),
            str(result[9])
        ]]
        radar.add(result[2], data, item_color=range_color[index])