Hello everyone,
I'm sure someone can point out my stupid error. I'm quite new to Vega Lite, slightly getting the hang of it.
Everything is working fine except that my numeric data and time data are mixed up as it seems. How can I fix this?
I know it's not a simple matter of sort:"". Setting the type of numericData to "quantitative" lets the data disappear for some reason. Maybe because they are integers?
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": {
"%context%": true,
"%timefield%": "@timestamp",
"index": "default-*",
"body": {"size": 100, "_source": ["numericData", "@timestamp"]}
},
"format": {"property": "hits.hits"}
},
"transform": [
{"calculate": "toDate(datum._source['@timestamp'])", "as": "time"}
],
"vconcat": [
{
"width": 1200,
"mark": "area",
"encoding": {
"x": {
"field": "time",
"scale": {"domain": {"selection": "brush"}},
"type": "temporal",
"axis": {"title": ""}
},
"y": {"field": "_source.numericData"}
}
},
{
"width": 1200,
"height": 60,
"mark": "area",
"selection": {"brush": {"type": "interval", "encodings": ["x"]}},
"encoding": {
"x": {"field": "time", "type": "temporal"},
"y": {
"field": "_source.numericData",
"axis": {"tickCount": 3, "grid": false}
}
}
}
]
}
This illustrates my output - time and intensity (0-10ish) are correct. The ordering is odd though.
How can I reorder the values for a correct intensity-time correlation?
Thanks in advance