layer usage example
avillafiorita opened this issue · comments
Adolfo Villafiorita commented
Hi,
first of all, thanks for the Gem, really clean and useful.
I am trying to use =layer=s and I am a bit lost on what to pass as argument. I tried to look at the code, to no avail.
Consider the following excerpt (from the Vega Light website):
"layer": [{
"mark": "bar"
},
{
"mark": {
"type": "text",
"align": "left",
"baseline": "middle",
"dx": 3
},
"encoding": {
"text": {"field": "b", "type": "quantitative"}
}
}]
}
when representing in Ruby, I thought I could do something like:
.layer([
Vega.lite.mark( { type: "bar" }),
Vega.lite.mark
...
])
but it does not work.
Any help really appreciated it.
Thanks again!
Andrew Kane commented
Hi @avillafiorita, you'll want to pass each layer as a hash rather than a Vite.lite
object.
Adolfo Villafiorita commented
... and, in fact, a Hash works fine!
thanks for the help!
For the sake of documentation, the example becomes:
layer([
{
mark: "bar"
},
{
mark: {
type: "text",
align: "left",
baseline: "middle",
dx: 3
},
encoding: {
text: { field: "b", type: "quantitative" }
}
}
])