Thanks for reply,
sure I can try to sum it up a bit.
This is my response of JSON query in Kibana Dev Tools:
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"houses" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 459508,
"buckets" : [
{
"key" : 1122,
"doc_count" : 41,
"room" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : 742,
"doc_count" : 41,
"colors" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "green",
"doc_count" : 24
},
{
"key" : "red",
"doc_count" : 17
}
]
}
}
]
}
}, ... ... ... # and so on
This is my Vega configuration right now:
{
"$schema": "https://vega.github.io/schema/vega/v2.json",
"description": "",
"title": "Total Overview Of Houses Room Colors",
"padding": 10,
"data": {
"name": "total_overview_house",
"url": {
"index": "indexname",
"body": {
# #####################################################
# ####################### json query ##################
# #####################################################
}
},
"format": {
"property": "aggregations.houses.buckets"
}
},
"scales":[
{
"name": "x",
"type": "band",
"domain" : { "data": "total_overview_house","field": "key" },
"range": "width",
"padding": 0.05,
"round": true
},
{
"name":"y",
"type": "linear",
"nice": true, "zero": true,
"domain":{ "data": "total_overview_house","field": "doc_count" },
"range":"height"
}
],
"axes": [
{ "orient": "bottom", "scale": "x" },
{ "orient": "left", "scale": "y" },
],
"marks": [
{
"type": "group",
"from": { "data":"total_overview_house" },
"encode": {
"enter": {
"x": { "scale": "x", "field": "key" },
"width": { "scale": "x", "band": 1 },
"y": { "scale": "y", "field": "doc_count" },
"y2": { "scale": "y", "value": 0 }
},
"update": {
"fill": { "value": "lightblue" }
},
"hover": {
"fill": { "value": "orange" }
}
}
},
{
"type": "text",
"encode": {
"enter": {
"align": { "value": "center" },
"baseline": { "value": "bottom" },
"fill": {"value": "#333" }
},
"update": {
"x": { "scale": "x", "signal": "tooltip.key", "band": 0.5 },
"y": { "scale": "y", "signal": "tooltip.doc_count", "offset": -2 },
"text": { "signal": "tooltip.doc_count" },
"fillOpacity": [
{ "test": "datum === tooltip", "value": 0 },
{ "value": 1 }
]
}
}
}
],
"signals": [
{
"name": "tooltip",
"value": { },
"on": [
{ "events": "rect:mouseover", "update": "datum" },
{ "events": "rect:mouseout", "update": "{}" }
]
}
]
}
In my Visualization I can see:
x-Axis: House Numbers
y-Axis: House Numbers Count.
What I actually try to achieve:
x-Axis: House Numbers
y-Axis: The Rooms with the count of each Color (of the houses) --> See Json Response
In the Docu of Vega I can not find the correct way to do that.
Thanks in advance.