本文介绍开发人员常用的四种Kibana Visualize图制作方法:Controls、Metric、Vertical Bar和TSVB。
本文还是以上<<Kibana对索引动态加字段显示>>文中索引为例,制作了一个订单数据仪表盘。
{
"_index":"es-syc-demo-order-2020.09",
"_type":"_doc",
"_id":"2020091822382704930",
"_version":1,
"_score":1,
"_source":{
"_class":"com.mingo.es.sync.document.OrderEntity",
"id":"2020091822382704930",
"tradeNo":"2020091822382704930",
"buyerId":9527,
"sellerId":18899,
"type":1,
"status":1,
"amount":1,
"discountAmount":0,
"originAmount":1,
"createTime":1600439907049,
"lines":[
{
"tradeNo":"2020091822382704930",
"lineNo":"1",
"itemCode":"6352678819",
"itemName":"泡椒凤爪",
"unitCode":"DAI",
"unitName":"袋",
"type":1,
"itemPrice":1,
"price":1,
"discountPrice":0,
"itemQty":1,
"totalPrice":1,
"paidPrice":1,
"createTime":1600439907049
}
]
}
}
先看结果,下面是四种类型的图作成的Dashboard
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084026t1.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084031t2.png)
同一个仪表盘中可以实现检索条件共享。
1. Controls
下拉框,用于枚举选择。可以有多选操作、多个下拉框级联操作等。
创建
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084036t3.png)
控件制作
交易类型
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084049t5.png)
订单状态
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084053t6.png)
勾选时数据刷新
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084128t12.png)
制作完成后
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084058t6_1.png)
2. Metric
主要用于数字显示。
创建
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084103t7.png)
控件制作
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084109t8.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084113t9.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084119t10.png)
制作完成后
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084123t11.png)
3. Vertical Bar
柱状图或者曲线显示。
创建
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928090054tttttt.png)
控件制作
Y轴数据
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083937q1.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083941q2.png)
X轴数据
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083946q3.png)
Y轴坐标,两个数据分别左右轴显示
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083953q4.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083958q5.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084005q6.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084010q7.png)
Legand显示
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928084017q8.png)
4. TSVB
可用于数据对比。比如今天和昨天的订单量对比。
创建
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928081340k1.png)
控件制作
索引选择
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083854k2_1.png)
“昨天”曲线制作
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083900k3.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083905k4.png)
“今天”曲线制作
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083909k5.png)
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083919k6.png)
图中显示
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083923k7.png)
制作完成后
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083847k2.png)
5. 仪表盘制作
创建Dashboard,用于展示图表。
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083928o1.png)
排版即可,勾选下拉框值时也就是加了过滤查询条件
![](https://images.cnblogs.com/cnblogs_com/doflamingo/1856019/o_200928083932o2.png)