I am having trouble with field names that have two or more dots.
According to the field documentation (https://vega.github.io/vega/docs/types/#Field), _To specify field names that contain dots but are not nested lookups, escape the dot inline ("my\\.field") or enclose the field name in brackets ("[my.field]")._
I can do this only with one dot. The following example (a.b) works well in the Vega Editor:
{
"data": {
"values": [
{
"color": "default",
"a.b": 28
}
]
},
"mark": "bar",
"encoding": {
"x": {
"field": "color",
"type": "nominal"
},
"y": {
"field": "[a.b]",
"type": "quantitative"
}
}
}
However, I can't get something like a.b.c working, neither with
"y": {
"field": "[a.b.c]",
"type": "quantitative"
}
nor with
"y": {
"field": "a\\.b\\.c",
"type": "quantitative"
}
Is this how it is supposed to work, or is this a bug?
Hope I was clear, thanks!
I have the same issue
I'll take a look. Can you make a small example and illustrate what doesn't work?
Thanks @domoritz!
Well, for example the following doesn't render a bar, like the first example.
{
"data": {
"values": [
{
"color": "default",
"a.b.c": 28
}
]
},
"mark": "bar",
"encoding": {
"x": {
"field": "color",
"type": "nominal"
},
"y": {
"field": "a\\.b\\.c",
"type": "quantitative"
}
}
}
I also tried the following, with no luck:
"field": "[a.b.c]",
Ahh, looks like we only replace the first ..

> 'a.b.c'.replace('.','\\.')
"a\\.b.c"
We need
> 'a.b.c'.replace(/\./g,'\\.')
"a\\.b\\.c"
Great, thanks!
Thank you for the bug report.
Most helpful comment
Ahh, looks like we only replace the first
..We need