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





边栏推荐
- SMARCA2抗体研究:Abnova SMARCA2 单克隆抗体方案
- 用户网络模型与QoE
- devpi
- Upload file list (repeated file names are marked with brackets)
- 手动备份和还原DHCP服务器
- About Statistical Distributions
- 福建的朋友们,你们的养老保险上云啦!
- Professor Michael Wooldridge of Oxford University: how the AI community views neural networks in the past 40 years
- leetcode 1647. Minimum deletions to make character frequencies unique
- OOM out of memory 内存溢出
猜你喜欢
随机推荐
A few lines of code can realize complex excel import and export. This tool class is really powerful!
Cross cluster deployment of helm applications using karmada
1 goal, 3 fields, 6 factors and 9 links of digital transformation
百度时间因子添加
ONEFLOW source code parsing: automatic inference of operator signature
原生实现.NET5.0+ 自定义日志
render函数解析
好用、强大的PDF 阅读软件综合评测:PDF Expert 、MarginNote、LiquidText、Notability、GoodNotes、Zotero
MongoDB系列之MongoDB工作原理简单介绍
About Critical Values
[unity3d] camera follow
OOM out of memory 内存溢出
Alist+RaiDrive 给电脑整个80亿GB硬盘
正版ST-link/V2 J-LINK JTAG/SWD引脚定义和注意事项
leetcode 1423. Maximum points you can obtain from cards
使用Karmada实现Helm应用的跨集群部署
SqlTransaction
牛津大学教授Michael Wooldridge:AI社区近40年如何看待神经网络
中金财富开户安全吗?开过中金财富的讲一下
Oom out of memory memory overflow









