Hi, I am attempting to make charts similar to Faceting a Plot into a Trellis Plot | Vega-Lite with multiple rows of charts, split using the row encoding.
(The link above should go to the section titled ' Row Facet (with Row Encoding)')
I don't want the chart to autosize, so have added autosize: none and height: 200 and width: 200.
However, then no chart appears, and in the debug it shows height and width as -10, with child_height and child_width at 200.
If I remove the row section it does work to resize the chart to 200x200.
Similarly if I remove autosize/height/width the chart renders multiple (v. large) charts in a row.
Vega spec (URL section removed as it contained data I can't share - the data request works fine):
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"autosize": {
"type": "none",
"contains": "padding"
},
"height": 200,
"width": 200,
"data": {
"format": {
"property": "aggregations.time_buckets.buckets"
},
"url": {},
"values": {
"took": 4,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 6316,
"max_score": null,
"hits": []
},
"aggregations": {
"time_buckets": {
"buckets": [
{
"key_as_string": "1614556800",
"key": 1614556800000,
"doc_count": 3540,
"alarms": {
"value": 0
},
"cols": {
"buckets": {
"incident": {
"doc_count": 2506
},
"servicerequest": {
"doc_count": 942
}
}
}
},
{
"key_as_string": "1617235200",
"key": 1617235200000,
"doc_count": 2682,
"alarms": {
"value": 0
},
"cols": {
"buckets": {
"incident": {
"doc_count": 1879
},
"servicerequest": {
"doc_count": 728
}
}
}
},
{
"key_as_string": "1619827200",
"key": 1619827200000,
"doc_count": 94,
"alarms": {
"value": 38523
},
"cols": {
"buckets": {
"incident": {
"doc_count": 0
},
"servicerequest": {
"doc_count": 0
}
}
}
}
]
}
}
}
},
"transform": [
{
"calculate": "datum.cols.buckets.incident.doc_count",
"as": "Incident"
},
{
"calculate": "datum.cols.buckets.servicerequest.doc_count",
"as": "Service Request"
},
{
"calculate": "datum.alarms.value",
"as": "Alarms"
},
{
"calculate": "datum.key",
"as": "Date"
},
{
"fold": [
"Alarms",
"Incident",
"Service Request"
]
}
],
"encoding": {
"y": {
"field": "key",
"type": "nominal"
},
"x": {
"field": "value",
"type": "quantitative"
},
"color": {
"field": "key",
"type": "nominal"
},
"row": {
"field": "Date",
"type": "ordinal",
"timeUnit": "monthyear"
}
},
"mark": "bar",
"resolve": {
"axis": {
"x": "independent"
}
},
"config": {
"range": {
"category": {
"scheme": "elastic"
}
},
"mark": {
"color": "#54B399"
},
"title": {
"color": "#343741"
},
"style": {
"guide-label": {
"fill": "#69707d"
},
"guide-title": {
"fill": "#343741"
},
"group-title": {
"fill": "#343741"
},
"group-subtitle": {
"fill": "#343741"
}
},
"axis": {
"tickColor": "#eef0f3",
"domainColor": "#eef0f3",
"gridColor": "#eef0f3"
},
"background": "transparent"
}
}
Here's the data after transform
Please let me know if there's any other info from the debug that is useful here.
Thanks!