code for labelAngle results in invalid json in vegalite editor
jjwAmtelco opened this issue · comments
the following code results in a labelangle property that the editor does not recognize. and if the case is changed to 'labelAngle:' it works fine in the editor. NOTE: The elixir code never changes the angle of the text; though it should since fixing the code in the editor works as expected. 'tickCount' has the same issue by the way,
`# elixir code
data = skill_stats
# data |> dbg
Vl.new(title: "Service Level By Skill", description: "")
|> Vl.data_from_values(data)
|> Vl.concat([
Vl.new(width: 700, height: 200)
|> Vl.encode_field(:x, "skill",type: :nominal,title: "",
axis: [ labelAngle: -45]
)
|> Vl.encode_field(:y, "value", type: :quantitative)
|> Vl.encode_field(:color, "series", scale: [scheme: "spectral"], legend: [orient: "left"] )
|> Vl.encode(:tooltip, [
[field: "series", type: :nominal, title: "category"],
[field: "value", type: :quantitative, title: "count"]
])
|> Vl.mark(:bar)
], :horizontal)
|> Vl.to_spec()
|> Jason.encode!()
`
[chart](Open the Chart in the Vega Editor)
We aromatically covert snake_case to camelCase, so if you do label_angle:
it should work as expected :)
@jonatanklosko we should probably add a small note to the docs, perhaps on the @moduledoc
. WDYT?
Perfect!
new to elixir; did not realize what that meant:
Most VegaLite functions accept an optional list of options, which are converted directly as the specification properties. To provide a more Elixir-friendly experience, the options are automatically normalized, so you can use keyword lists and snake-case atom keys.
do now :-)
Thank you!!