Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"config": {"axisX": {"title": "foo"}} removes title #9429

Open
mattijn opened this issue Sep 8, 2024 · 5 comments
Open

"config": {"axisX": {"title": "foo"}} removes title #9429

mattijn opened this issue Sep 8, 2024 · 5 comments
Labels

Comments

@mattijn
Copy link
Contributor

mattijn commented Sep 8, 2024

As was raised at the Altair repo: vega/altair#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:
image

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.

@clairenied
Copy link

Hey! Is this a good first issue? If so, I might be interested in taking it. Let me know!

@domoritz
Copy link
Member

domoritz commented Sep 9, 2024

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.

@clairenied
Copy link

Sweet! I will start poking around on this.

@clairenied
Copy link

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.

@domoritz
Copy link
Member

No need to assign the issue formally from our side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants