Keyword atom config should honor cases since config is case-sensitive
christhekeele opened this issue · comments
I noticed that this does not render as desired, with the x
axis on top:
VegaLite.new
|> VegaLite.config(axisX: [orient: "top"])
|> VegaLite.mark(:square)
|> VegaLite.encode_field(:x, "x")
|> VegaLite.encode_field(:y, "y")
|> VegaLite.data_from_values([%{x: 0, y: 0}, %{x: 1, y: 1}])
VegaLite
is downcasing the axisX
atom in the config, becoming:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"config": {"axisx": {"orient": "top"}},
"data": {"values": [{"x": 0, "y": 0}, {"x": 1, "y": 1}]},
"encoding": {"x": {"field": "x"}, "y": {"field": "y"}},
"mark": "square"
}
Which renders as:
Using a two-tuple list preserves the casing and works, so this is only a minor wart on the DSL:
VegaLite.new
|> VegaLite.config([{"axisX", [orient: "top"]}])
|> VegaLite.mark(:square)
|> VegaLite.encode_field(:x, "x")
|> VegaLite.encode_field(:y, "y")
|> VegaLite.data_from_values([%{x: 0, y: 0}, %{x: 1, y: 1}])
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"config": {"axisX": {"orient": "top"}},
"data": {"values": [{"x": 0, "y": 0}, {"x": 1, "y": 1}]},
"encoding": {"x": {"field": "x"}, "y": {"field": "y"}},
"mark": "square"
}
Hey @christhekeele! The keys are automatically converted from snake_case to camelCase (as noted here), so if you do axis_x: [orient: "top"]
it should work fine :)
Oh I totally missed that, thank you!