当前位置:网站首页>grafana绘制走势图
grafana绘制走势图
2022-06-28 18:39:00 【南湖渔歌】
示例数据:
use test_bi;
CREATE TABLE `orderpaytable` (
`time1` varchar(20) DEFAULT NULL,
`time2` varchar(20) DEFAULT NULL,
`orderpay` int(10) DEFAULT NULL,
`month_rate` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
# 插入数据
INSERT INTO test_bi.orderpaytable (time1,time2,orderpay,month_rate) VALUES
('2016-01','2016-01-01',1407993,NULL),
('2016-02','2016-02-01',684899,-0.51),
('2016-03','2016-03-01',1297697,0.89),
('2016-04','2016-04-01',1183767,-0.09),
('2016-05','2016-05-01',1691896,0.43),
('2016-06','2016-06-01',1450639,-0.14),
('2016-07','2016-07-01',1152697,-0.21),
('2016-08','2016-08-01',1318004,0.14),
('2016-09','2016-09-01',1289457,-0.02),
('2016-10','2016-10-01',1134492,-0.12),
('2016-11','2016-11-01',1243779,0.10),
('2016-12','2016-12-01',1270597,0.02),
('2017-01','2017-01-01',1305803,0.03),
('2017-02','2017-02-01',786593,-0.40),
('2017-03','2017-03-01',987215,0.26),
('2017-04','2017-04-01',883131,-0.11),
('2017-05','2017-05-01',1125141,0.27),
('2017-06','2017-06-01',1036588,-0.08),
('2017-07','2017-07-01',946463,-0.09),
('2017-08','2017-08-01',1282120,0.35),
('2017-09','2017-09-01',1139918,-0.11),
('2017-10','2017-10-01',1136302,0.00),
('2017-11','2017-11-01',1179867,0.04),
('2017-12','2017-12-01',1208147,0.02);

做可视化展示:
select STR_TO_DATE( time2 ,'%Y-%m-%d') as time
,orderpay as 本月
from test_bi.orderpaytable
select STR_TO_DATE( time2 ,'%Y-%m-%d') as time
,lag(orderpay,1)over() as 上月
from test_bi.orderpaytable
Time series:


select STR_TO_DATE( time2 ,'%Y-%m-%d') as time
,orderpay as 本月
from test_bi.orderpaytable;
select STR_TO_DATE( time2 ,'%Y-%m-%d') as time
,month_rate as 环比率
from test_bi.orderpaytable





边栏推荐
- leetcode 1647. Minimum deletions to make character frequencies unique
- Steam education to break the barriers between disciplines
- leetcode 1647. Minimum Deletions to Make Character Frequencies Unique(所有字母频率不同的最小删除次数)
- Openfire用户以及群组关系移植
- Cannot read property 'MTJ' of undefined
- 闭包的理解
- Servlet的使用手把手教学(一)
- About Critical Values
- Shell unknown rollup 1
- leetcode 1423. Maximum points you can obtain from cards
猜你喜欢

C# 41. Int to string

MindSpore系列一加载图像分类数据集

Anonymous function variable problem

Seata implementation of sharing JDBC distributed transaction

Chapter 2 processing files, cameras and GUI Cameo applications

1 invalid import format(s) Postman Collection Format v1 is no longer supported and can not be import

内存泄露

Shanghai Pudong Development Bank Software Test interview real question

Qt 中 QObjectCleanupHandler 使用总结

Lumiprobe丨Lumizol RNA 提取试剂解决方案
随机推荐
Mindspire series one loading image classification data set
Anonymous function variable problem
【Unity3D】发射(RayCast)物理射线(Ray)
id门禁卡复制到手机_怎么把手机变成门禁卡 手机NFC复制门禁卡图文教程
Pipeline based hybrid rendering
用户网络模型与QoE
PostgreSQL database docker
从理论到实践增强STEAM和工程教育
C语言指针的一些易错点
About covariance and correlation
Installing the nodejs environment
19.2 容器分类、array、vector容器精解
从知名软件提取出的神器,吊打一众付费
devpi
ONEFLOW source code parsing: automatic inference of operator signature
SqlTransaction
BioVendor游离轻链(κ和λ)Elisa 试剂盒检测步骤
Operations research note
Record an emotet Trojan horse handling case
Modular operation