def show_gauge(self):
        X = random.randint(0, 200)
        gauge = Gauge('定时更新仪表盘')

        gauge.add('电压', 'V', X, scale_range=[0, 200])
        gauge.render('html/test_4.html')
        self.Web.load(
            QUrl('file:///untitled4/pyecharts数据可视化/html/test_4.html'))
Exemplo n.º 2
0
def test_gauge():

    # gauge_0
    gauge = Gauge("仪表盘示例")
    gauge.add("业务指标", "完成率", 66.66)
    gauge.show_config()
    gauge.render()

    # gauge_1
    gauge = Gauge("仪表盘示例")
    gauge.add("业务指标", "完成率", 166.66, angle_range=[180, 0], scale_range=[0, 200], is_legend_show=False)
    gauge.show_config()
    gauge.render()
Exemplo n.º 3
0
def dashboard():
    '''仪表盘'''
    gauge = Gauge('Results of each interface test')
    style = Style()
    gauge_style = style.add(label_pos='center',
                            is_label_show=True,
                            label_text_color=None)

    gauge.add('Login Interface Test', 'Rate of passing', 70, **gauge_style)

    #gauge.add('FangYuan Interface Test','Rate of passing',60,**gauge_style)
    gauge.show_config()
    gauge.render(filename)
Exemplo n.º 4
0
def Analysis(lyric):
    module = 'wenzhi'
    action = 'TextSentiment'
    config = {
        'Region': 'sz',
        'secretId': 'AKIDBHCx49tBzc5eTIA6kFoddWUXQDbpq7JQ',
        'secretKey': 'gCXHsHFD1eDjJgT7b3TkI4fu1wnjDYbU',
        'method': 'post',
    }
    params = {
        'content': lyric,  # 需要分析的歌词
        'type': 4,
    }
    try:
        service = QcloudApi(module, config)
        result = service.call(action, params)
    except Exception as e:
        import traceback
        print('traceback.format_exc():\n%s' % traceback.format_exc())

    # 图1
    result = eval(str(result, encoding="utf-8"))
    negative_value = round(result['negative'], 4)
    positive_value = round(result['positive'], 4)
    gauge = Gauge("Sentiment",
                  background_color=None,
                  title_color="#274C77",
                  title_text_size=20)
    gauge.add("Probability of Negative Property",
              "Negative",
              value=negative_value * 100,
              legend_text_color="#274C77",
              legend_text_size=15,
              lable_color=["E7ECEF", "#274C77", "FB6107"])

    # gauge.show_config()
    gauge.render('gauge.html')

    # 图2
    liquid2 = Liquid(title="Probability of Positive Property",
                     title_pos='center')
    liquid2.add("Probability of Positive Property",
                [positive_value, 0.5, 0.4, 0.3],
                is_liquid_outline_show=False,
                shape="pin",
                liquid_color=["E7ECEF", "#274C77", "FB6107"])
    # liquid2.show_config()
    liquid2.render('pin.html')
Exemplo n.º 5
0
def Plot_Satification(data, json_data=None):
    'weight power based on comment votes'
    if not json_data == None:
        votes = [
            int(json_data[comment]['Comment Votes']) for comment in json_data
            if comment != 'film'
        ]
        votes_sum = sum(votes)
        power = [(vote + int(bool(vote == 0))) / votes_sum for vote in votes]
        satif = sum([i * j for i, j in zip(data, power)]) * 100
    else:
        data = [i + int(bool(i == 0)) for i in data]
        satif = sum(data) / len(data) * 100
    gauge = Gauge("Satification", title_pos='center')
    gauge.add("Satification", "motion rank", round(satif, 3))
    gauge.render("./analysis/Satification.html")
    return None
Exemplo n.º 6
0
def test_gauge():
    # gauge default
    gauge = Gauge("仪表盘示例")
    gauge.add("业务指标", "完成率", 66.66)
    gauge.show_config()
    assert "66.66" in gauge._repr_html_()
    gauge.render()

    # gauge angle_range&scale_range
    gauge = Gauge("仪表盘示例")
    gauge.add("业务指标",
              "完成率",
              166.66,
              angle_range=[180, 0],
              scale_range=[0, 200],
              is_legend_show=False)
    assert "166.66" in gauge._repr_html_()
    gauge.render()
Exemplo n.º 7
0
attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
value = [1, 11, 15, 30, 45, 101]
funnel = Funnel("漏斗图示例")
funnel.add("商品", attr, value, is_label_show=True,
           label_pos="inside", label_text_color="#fff")
funnel.render('funnel.html')


# ----------------------------------------------------------------------------
# Gauge
from pyecharts import Gauge,Liquid

gauge = Gauge("仪表盘示例")
gauge.add("业务指标", "完成率", 166.66, angle_range=[180, 0],
          scale_range=[0, 200], is_legend_show=False)
gauge.render('Gauge.html')

liquid = Liquid("水球图示例")
liquid.add("Liquid", [0.6])
liquid.render()

# ----------------------------------------------------------------------------
# heatmap
import random
from pyecharts import HeatMap

x_axis = [
    "12a", "1a", "2a", "3a", "4a", "5a", "6a", "7a", "8a", "9a", "10a", "11a",
    "12p", "1p", "2p", "3p", "4p", "5p", "6p", "7p", "8p", "9p", "10p", "11p"]
y_axis = [
    "Saturday", "Friday", "Thursday", "Wednesday", "Tuesday", "Monday", "Sunday"]
Exemplo n.º 8
0
from pyecharts import Gauge

gauge = Gauge("仪表盘示例")
gauge.add("业务指标", "完成率", 66.66)
gauge.show_config()
gauge.render(path="dashboard.html")
#仪表盘简单使用
from pyecharts import Gauge

gauge = Gauge('仪表盘示例')
gauge.add(
    '电压值',
    'V',
    300,
    scale_range=[0, 500],
)
#  add(name, attr, value,
# scale_range=None,
# angle_range=None, **kwargs)
# name -> str 图例名称
# attr -> list属性名称
# value -> list属性所对应的值
# scale_range -> list仪表盘数据范围。默认为 [0, 100]
# angle_range -> list仪表盘角度范围。默认为 [225, -45]
gauge.render('html/test_2.html')
Exemplo n.º 10
0
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> # Part 3 Create Gauge with Pyecharts
>>> from pyecharts import Gauge
>>> gauge=Gauge("KPI Completion Rate Dashboard")
>>> gauge.add("KPI","CompletionRate",66.66)
<pyecharts.charts.gauge.Gauge object at 0x02D48F50>
>>> gauge.render()
>>> 
Exemplo n.º 11
0
from pyecharts import Gauge

# 仪表盘
gauge = Gauge("大标题")
# scale_range设置仪表盘数据范围,angle_range设置角度范围
gauge.add("仪表盘顶部的标题",
          "仪表盘上的标题",
          80.2,
          scale_range=[0, 250],
          angle_range=[225, -45])
gauge.render("./gauge.html")
Exemplo n.º 12
0
#coding:utf-8
import sys
from pyecharts import Line3D

# 3D折线图
data = [[1, 2, 3, 4], [1, 2, 3, 4], [0, 4, 8, 16]]
Line3D = Line3D("3D 折线图示例", width=1200, height=600)
Line3D.add("", data, is_visualmap=True)
Line3D.render('E:\\pye\\line3d.html')  # 在指定目录下生成文件

#coding:utf-8
from pyecharts import Gauge
# 仪表盘
gauge = Gauge('项目完成进度')
gauge.add('进度表', '完成率', 88.88)
gauge.render('E:\\pye\\gauge.html')  # 在指定目录下生成文件

#coding:utf-8
from pyecharts import Funnel
# 漏斗图
attr = ['认知', '了解', '认可', '考虑', '意向', '购买']
value = [120, 100, 80, 60, 40, 20]
funnel = Funnel('客户购买分析图')
funnel.add('买车',
           attr,
           value,
           is_label_show=True,
           label_pos='inside',
           label_text_color='#fff')
funnel.render('E:\\pye\\funel.html')  # 在指定目录下生成文件
Exemplo n.º 13
0
from pyecharts import Funnel, Gauge, Graph

attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 56, 78, 100]
v2 = [55, 60, 16, 20, 15, 80]
# 仪表盘
gauge = Gauge("仪表盘")
gauge.add('业务指标', '完成率', 66.66)
gauge.show_config()
gauge.render(path="./statistic.html")
Exemplo n.º 14
0
es = EffectScatter("带有涟漪特效动画的动态散点图示例")
es.add("effectScatter", v1, v2)
es.render("effect_scatter.html")

from pyecharts import Pie
attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [11, 12, 13, 10, 10, 10]
pie = Pie("饼图示例")
pie.add("", attr, v1, is_label_show=True)
pie.render("pie.html")

from pyecharts import Gauge
gauge = Gauge("仪表盘示例")
gauge.add("业务指标", "完成率", 66.66)
gauge.show_config()
gauge.render("gauge.html")

from pyecharts import Line, Overlap, Bar

attr = ['A', 'B', 'C', 'D', 'E', 'F']

v1 = [10, 20, 30, 40, 50, 60]
v2 = [38, 28, 58, 48, 78, 68]

bar = Bar('Line-Bar')
bar.add('bar', attr, v1)
line = Line()
line.add('line', attr, v2)

overlap = Overlap()
overlap.add(bar)
Exemplo n.º 15
0
def getCPUState(interval=1):
    cpuCount = psutil.cpu_count()
    cpuPercent = psutil.cpu_percent(interval)
    return (str(cpuCount), str(cpuPercent))

# def gauge_color() -> Gauge:
#     c = (
#         Gauge()
#         .add(
#             "业务指标",
#             [("完成率", 55.5)],
#             axisline_opts=opts.AxisLineOpts(
#                 linestyle_opts=opts.LineStyleOpts(
#                     color=[(0.3, "#67e0e3"), (0.7, "#37a2da"), (1, "#fd666d")], width=30
#                 )
#             ),
#         )
#         .set_global_opts(
#             title_opts=opts.TitleOpts(title="Gauge-不同颜色"),
#             legend_opts=opts.LegendOpts(is_show=False),
#         )
#     )
#     return c

ga = Gauge('CPU监控')
ga.use_theme('roma')
ga.add('CPU 核心数 {} '.format(getCPUState()[0]),'CPU 使用率',getCPUState()[1])
ga.render('6.html')

Exemplo n.º 16
0
def build_chart_gauge(filename,title1:str,title2:str,data:float):
    pie = Gauge(width=400,height=200)
    pie.add(title1,title2,data)
    pie.render(filename)
Exemplo n.º 17
0
import numpy as np
from pyecharts import Gauge

gu = Gauge("模型精度占比")
gu.add("在线", "离线", 62.63)

gu.render(r"C:\Users\Administrator\Desktop\占比.html")
Exemplo n.º 18
0
from pyecharts import Gauge

gaue = Gauge("仪表盘示例")
gaue.add("业务指标", "完成指标", 66.66, is_more_utils=True)
gaue.render(path="gaue.html")
Exemplo n.º 19
0
from pyecharts import Bar, Line,Overlap #导入相关模块
line = Line('') #创建一个实例对象
line.add('国内生产总值',GDP_data.时间,GDP_data['国内生产总值_当季值(亿元)'],mark_point=['average','max','min'],
         mark_point_symbol='diamond',mark_point_textcolor ='blue')
bar = Bar('GDP变化趋势')
bar.add('工业增加值',GDP_data['时间'],GDP_data['工业增加值_当季值(亿元)'])
overlap = Overlap() #
overlap.add(line)
overlap.add(bar)
overlap.render('GDPdata.html')

# # # # # # 仪表盘
from pyecharts import Gauge
gauge =Gauge('目标完成率')
gauge.add('任务指标','完成率',90)
gauge.render('目标完成率.html')

# # # # # # 箱线图
Titanic = pd.read_csv('titanic_train.csv')
#检查年龄是否有缺失
any(Titanic['Age'].isnull())
# 删除缺失值
Titanic['Age'].dropna(inplace=True)
from pyecharts import Boxplot
boxplot = Boxplot('年龄箱线图')
x_axis = ['年龄']
y_axis = Titanic['Age'].values
y_axis = list(np.reshape(y_axis,(1,-1)))
_yaxis = boxplot.prepare_data(y_axis) #必须要将数据进行转换
boxplot.add('箱线图',x_axis,_yaxis)
boxplot.render('boxplot.html')
Exemplo n.º 20
0
def yibiaopan():
    '''仪表盘图'''

    gauge = Gauge("仪表盘示例")
    gauge.add("业务指标", "完成率", 66.66)
    gauge.render('./info/仪表盘.html')
Exemplo n.º 21
0
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 10 18:13:19 2017

@author: 17549
"""

from pyecharts import Gauge
gauge = Gauge("仪表盘图")
gauge.add("业务指标", "完成率", 66.66)
gauge.show_config()
gauge.render(r"E:\13_仪表盘图.html")
Exemplo n.º 22
0
from pyecharts import Gauge
gauge = Gauge("仪表盘实例","hello world")
gauge.add("学习","进度",10.00)
gauge.render(r'C:\Users\Administrator\Desktop\数据可视化\pyecharts\html\9.html')
Exemplo n.º 23
0
#!/usr/bin/env python3

from pyecharts import Gauge

gauge = Gauge("仪表盘示例")
gauge.add("业务指标", "完成率", 66.66)
gauge.show_config()
gauge.render()
Exemplo n.º 24
0
# data2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8]
line = Line("气温变化折线图", '2018-4-16', width=1200, height=600)
line.add("最高气温",
         cities,
         data3,
         mark_point=['average'],
         is_datazoom_show=False,
         is_label_show=True)
# line.add("最低气温", cities, data2, mark_line=['average'], is_smooth=True)
# line.render('Line-High-Low.html')
line.render(path='折线图.gif')

# 仪表盘图
gu = Gauge("仪表盘图")
gu.add("指标", "达标", 85)
gu.render("Guage-eg.html")

# 导入饼图Pie
# 设置主标题与副标题,标题设置居中,设置宽度为900
pie = Pie("饼状图", "一年的降水量与蒸发量", title_pos='center', width=900)
# 加入数据,设置坐标位置为【25,50】,上方的colums选项取消显示
pie.add("降水量", columns, data1, center=[25, 50], is_legend_show=True)
# 加入数据,设置坐标位置为【75,50】,上方的colums选项取消显示,显示label标签
pie.add("蒸发量",
        columns,
        data2,
        center=[75, 50],
        is_legend_show=False,
        is_label_show=True)
# 保存图表
pie.render("pie.html")
Exemplo n.º 25
0
attr = ["China", "Canada", "Brazil", "Russia", "United States"]

map0 = Map("世界地图示例", width=1200, height=600)
map0.add("世界地图",
         attr,
         value,
         maptype="world",
         is_visualmap=True,
         visual_text_color='#000')
map0.render(path="./data/04-00世界地图.html")

# 仪表盘
gauge = Gauge("仪表盘")
gauge.add('业务指标', '完成率', 66.66)
gauge.show_config()
gauge.render(path="./data/02-02仪表盘.html")
"""
# 关系图
nodes =[{"name": "结点1", "symbolSize": 10}, {"name": "结点2", "symbolSize": 20}, {"name": "结点3", "symbolSize": 30}, {"name": "结点4", "symbolSize": 40}, {"name": "结点5", "symbolSize": 50}, {"name": "结点6", "symbolSize": 40}, {"name": "结点7", "symbolSize": 30}, {"name": "结点8", "symbolSize": 20}]
links =[]
for i in nodes:
    for j in nodes:
        links.append({"source": i.get('name'), "target": j.get('name')})

print(links)
print(nodes)
graph =Graph("关系图-环形布局示例")
graph.add("", nodes, links, is_label_show=True, repulsion=8000,     layout='circular', label_text_color=None)
graph.show_config()
graph.render(path="./data/02-03关系图.html")
"""
Exemplo n.º 26
0
def ybp_cpu_load(location='/var/www/html/index.html'):
    gauge = Gauge('CPU负载图')
    gauge.add('CPU负载/每秒/%s' % datetime.datetime.now().strftime('%H:%M:%S') , 'CPU负载', cpu_info(1))
    gauge.render(location)