【发布时间】:2020-03-27 17:13:39
【问题描述】:
通过查看https://vega.github.io/editor/#/examples/vega-lite/bar_grouped,它显示了从数据表创建分组条形图的示例。
在我的情况下,因为我从 elasticsearch 获取数据,所以它不是表格形式。
我想不出一种方法来为存储桶上的每个总和指标创建两个条形图。
"buckets" : [
{
"key_as_string" : "03/Dec/2019:00:00:00 +0900",
"key" : 1575298800000,
"doc_count" : 11187,
"deploy_agg" : {
"buckets" : {
"deploy_count" : {
"doc_count" : 43
}
}
},
"start_agg" : {
"buckets" : {
"start_count" : {
"doc_count" : 171
}
}
},
"sum_start_agg" : {
"value" : 171.0
},
"sum_deploy_agg" : {
"value" : 43.0
}
},..
我想创建两个条形图,一个代表 sum_start_agg 的值,另一个代表 sum_deploy_agg 的值。
这是我为一张条形图所做的。
"encoding": {
"x": {
"field": "key",
"type": "temporal",
"axis": {"title": "DATE"}
},
"y": {
"field": "deploy_agg.buckets.deploy_count.doc_count",
"type": "quantitative",
"axis": {"title": "deploy_count"}
}
"color": {"value": "green"}
"tooltip": [
{
"field": "deploy_agg.buckets.deploy_count.doc_count",
"type": "quantitative",
"title":"value"
}
]
}
【问题讨论】:
标签: elasticsearch kibana vega-lite