Hi there!
I'm successfully being able to flatten a nested field in VegaLite (several nestings, by the way).
However, even if the flattened field is recognized, I get undefined when accessing the fields.
Any ideas why this might happen?
I'm doing this:
"transform": [
{"calculate": "datum.frequencies.freqs.buckets", "as": "F"},
{"flatten": ["F"]},
{"flatten": ["F.rangos.buckets"]}
],
"mark": "point",
"encoding": {"x": {"field": "F.rangos.buckets.key"}, "y": {"field": "F.rangos.buckets.doc_count"}}
}
But even if I can properly see the flattened F.rangos.buckets, I still get undefined for key and doc_count:
No clues why this is happening, as I can properly access any other F fields with no issues.
Thanks a lot in advance for your help!
My whole code below, in case it helps:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"values": [
{
"key" : "es",
"doc_count" : 138903384,
"frequencies" : {
"doc_count" : 1403494559,
"freqs" : {
"buckets" : [
{
"key": 314000,
"doc_count": 59767102,
"rangos": {
"buckets": [
{"key": "1.0-29.0", "from": 1, "to": 29, "doc_count": 104},
{"key": "30.0-34.0", "from": 30, "to": 34, "doc_count": 681}
]
}
},
{
"key": 266000,
"doc_count": 59764524,
"rangos": {
"buckets": [
{"key": "1.0-29.0", "from": 1, "to": 29, "doc_count": 509},
{"key": "30.0-34.0", "from": 30, "to": 34, "doc_count": 3201}
]
}
}
]
}
}
}
]
},
"transform": [
{"calculate": "datum.frequencies.freqs.buckets", "as": "F"},
{"flatten": ["F"]},
{"flatten": ["F.rangos.buckets"]}
],
"mark": "point",
"encoding": {"x": {"field": "F.rangos.buckets.key"}, "y": {"field": "F.rangos.buckets.doc_count"}}
}