当前位置:网站首页>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





边栏推荐
- 应用实践 | 10 亿数据秒级关联,货拉拉基于 Apache Doris 的 OLAP 体系演进(附 PPT 下载)
- WiFi安全漏洞KRACK深度解读
- 使用Karmada实现Helm应用的跨集群部署
- 1 invalid import format(s) Postman Collection Format v1 is no longer supported and can not be import
- Shell 未知汇总1
- Collection of real test questions
- Opencv中使用Tracker实现物体跟踪
- AOSP清华镜像下载错误解决
- curl: (56) Recv failure: Connection reset by peer
- 技术管理进阶——管理者如何做绩效沟通及把控风险
猜你喜欢

Pipeline based hybrid rendering

180.1. Log in continuously for n days (database)

匿名函数this指向以及变量提升

Professor Michael Wooldridge of Oxford University: how the AI community views neural networks in the past 40 years

基于管线的混合渲染

抗兔Dylight 488丨Abbkine通用型免疫荧光(IF)工具箱

curl: (56) Recv failure: Connection reset by peer

闭包的理解

Openharmony - detailed source code of Kernel Object Events

Lumiprobe丨Lumizol RNA 提取试剂解决方案
随机推荐
几行代码就能实现复杂的 Excel 导入导出,这个工具类真心强大!
1 goal, 3 fields, 6 factors and 9 links of digital transformation
[unity3d] camera follow
Openfire 3.8.2集群配置
About Significance Tests
【Unity3D】发射(RayCast)物理射线(Ray)
FFmpeg学习总结
Tensorboard Usage Summary
深入解析kubernetes中的选举机制
Cross cluster deployment of helm applications using karmada
C语言指针的一些易错点
Steam education to break the barriers between disciplines
MongoDB系列之MongoDB工作原理简单介绍
⼤⼚⾯试真题集合
What are the design requirements for PCB layout and wiring?
匿名函数this指向以及变量提升
解析机器人主持教学的实践发展
leetcode 1647. Minimum deletions to make character frequencies unique
Can I open an account today and buy shares today? Is it safe to open an account online?
业务层修改--根据现有框架的反推修改