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

Vega lite - Cannot use datum expr in scale padding #3867

Closed
nhannt201 opened this issue Feb 1, 2024 · 0 comments
Closed

Vega lite - Cannot use datum expr in scale padding #3867

nhannt201 opened this issue Feb 1, 2024 · 0 comments
Labels
bug For bugs or other software errors

Comments

@nhannt201
Copy link

nhannt201 commented Feb 1, 2024

I'm having trouble utilizing "datum" within "expr" in vega-lite scale padding. I'm attempting to calculate the padding adjustment value but keep encountering the error "datum is not defined." I'm currently using vega-lite v5, and encountering this issue when applying the JSON code.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "values": [
      {"x": 1, "y": 10},
      {"x": 2, "y": 5},
      {"x": 3, "y": -3},
      {"x": 4, "y": 8}
    ]
  },
  "mark": "point",
  "encoding": {
    "x": {
      "field": "x",
      "type": "quantitative",
      "scale": {"padding": {"expr": "datum.y < 3 ? 20 : 0"}}
    },
    "y": {"field": "y", "type": "quantitative"}
  }
}

The document below describes how I can use expr, but in fact, it does not fully support the expr syntax in the above case, specifically does not support "datum".

image

Is there any solution to solve the above problem?

@nhannt201 nhannt201 added the bug For bugs or other software errors label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For bugs or other software errors
Projects
None yet
Development

No branches or pull requests

1 participant