Adding non channel items results in an error
mfeckie opened this issue · comments
If I try add view
(https://vega.github.io/vega-lite/docs/spec.html for configuring background of the chart https://vega.github.io/vega-lite/docs/spec.html#view-background) to the spec like this
|> VegaLite.encode(:view,
fill: "#f3f3f3"
)
it results in an error unknown channel, expected one of :x, ...
We are limited by this collection of known channels:
https://github.com/livebook-dev/vega_lite/blob/v0.1.6/lib/vega_lite.ex#L374-L388
The workaround I can do is
|> VegaLite.to_spec()
|> Map.put("view", %{fill: "#f3f3f2"})
Would there be place for a non-channel function for adding to the spec?
Hey @mfeckie! You can pass arbitrary top-level properties when creating the struct, in this case:
VegaLite.new(view: [fill: "#f3f3f2"])
Is this what you are looking for?
Perfect, thanks!