`"config": {"axisX": {"title": "foo"}}` removes title
As was raised at the Altair repo: https://github.com/vega/altair/issues/3582
When defining the x-axis title using the general config object, as such: (Open the Chart in the Vega Editor)
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.20.1.json",
"data": {"values": [{"a": 1, "b": 4}, {"a": 2, "b": 5}, {"a": 3, "b": 6}]},
"mark": {"type": "line"},
"encoding": {"x": {"field": "a"}, "y": {"field": "b"}},
"config": {"axisX": {"title": "foo"}}
}
It is rendered like:
As can be seen, the x-axis title is removed completely.
Upon inspecting the compilation process, I noticed that the general axis configuration in Vega-Lite is directly mapped to a Vega config object. But, the Vega config object is essentially a subset of the available Vega-Lite configuration for axis properties. Since title is not defined as one of the axis properties in the Vega general config (source), but it is clearly defined as a Vega-Lite axis property, leading to a mismatch.
I believe there are a couple of possible solutions:
- The VL schema could be adjusted to reflect that the general axis config object in Vega-Lite is a subset of the available axis properties.
- The compilation process from Vega-Lite to Vega could be improved or extended to ensure it does not directly map the general config object to Vega but also accounts for Vega-Lite-specific properties like title.
It's odd though, that Vega removes the axis title during rendering, even though it's not part of its schema.
Hey! Is this a good first issue? If so, I might be interested in taking it. Let me know!
The config is for general properties and I think the specific axis title shouldn't be supported (which is how Vega behaves). We should not allow it in Vega-Lite and remove support for it from the schema (via removing it from the allowed types). @clairenied, yes, this is a great issue to tackle.
Sweet! I will start poking around on this.
Oh! It looks like I am not authorized to assign the issue to myself, so if you would like, please feel free to assign it to me if that is in line with your workflow.
No need to assign the issue formally from our side.