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

Boolean axis properties do not respond to expressions #6986

Closed
jwoLondon opened this issue Oct 18, 2020 · 4 comments · Fixed by #7148
Closed

Boolean axis properties do not respond to expressions #6986

jwoLondon opened this issue Oct 18, 2020 · 4 comments · Fixed by #7148
Assignees
Labels
Bug 🐛 P3 Should be fixed at some point
Milestone

Comments

@jwoLondon
Copy link
Contributor

Expanding on #6962 none of the Boolean axis properties appear to respond to expressions. Here is a minimal example to illustrate the problem:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "params": [
    {"name": "domain", "value": true, "bind": {"input": "checkbox"}},
    {"name": "labels", "value": true, "bind": {"input": "checkbox"}},
    {"name": "tickExtra", "value": true, "bind": {"input": "checkbox"}},
    {"name": "tickRound", "value": true, "bind": {"input": "checkbox"}},
    {"name": "ticks", "value": true, "bind": {"input": "checkbox"}},
    {"name": "grd", "value": true, "bind": {"input": "checkbox"}}
  ],
  "data": {
    "url": "https://cdn.jsdelivr.net/npm/[email protected]/data/movies.json"
  },
  "encoding": {
    "x": {
      "field": "IMDB Rating",
      "bin": true,
      "type": "ordinal",
      "axis": {
        "domain": {"expr": "domain"},
        "labels": {"expr": "labels"},
        "tickExtra": {"expr": "tickExtra"},
        "tickRound": {"expr": "tickRound"},
        "ticks": {"expr": "ticks"},
        "grid": {"expr": "grid"}
      }
    },
    "y": {"aggregate": "count"}
  },
  "mark": "bar"
}

Of the 6 Boolean properties, only grid has no claim in the schema not to accept expressions (although it would be nice if it could).

domain, labels, tickExtra, tickRound and ticks all allow expressions, but have no effect.

Looking at the compiled Vega Spec, it looks like the axes are being specified twice, and only one of them carries all the expressions through as signals (but tickExtra and tickRound are included in both). Perhaps this is part of the problem?

Vega specification:

 "axes": [
    {
      "scale": "x",
      "orient": "bottom",
      "grid": {"signal": "grid"},
      "tickExtra": {"signal": "tickExtra"},
      "tickRound": {"signal": "tickRound"},
      "gridScale": "y",
      "domain": false,
      "labels": false,
      "aria": false,
      "maxExtent": 0,
      "minExtent": 0,
      "ticks": false,
      "zindex": 0
    },
    {
      "scale": "y",
      "orient": "left",
      "gridScale": "x",
      "grid": true,
      "tickCount": {"signal": "ceil(height/40)"},
      "domain": false,
      "labels": false,
      "aria": false,
      "maxExtent": 0,
      "minExtent": 0,
      "ticks": false,
      "zindex": 0
    },
    {
      "scale": "x",
      "orient": "bottom",
      "grid": false,
      "title": "IMDB Rating (binned)",
      "domain": {"signal": "domain"},
      "labels": {"signal": "labels"},
      "tickExtra": {"signal": "tickExtra"},
      "tickRound": {"signal": "tickRound"},
      "ticks": {"signal": "ticks"},
      "labelAlign": "right",
      "labelAngle": 270,
      "labelBaseline": "middle",
      "zindex": 0
    },
    {
      "scale": "y",
      "orient": "left",
      "grid": false,
      "title": "Count of Records",
      "labelOverlap": true,
      "tickCount": {"signal": "ceil(height/40)"},
      "zindex": 0
    }
  ]
@domoritz
Copy link
Member

We specify axes twice because of a limitation in Vega. One of the axes is just for the gridlines and the other is for the rest. See vega/vega#1865 for details.

The fact that axes don't respond to signal changes looks like an issue with Vega.

@jheer I don't see an issue in the generated Vega. Please return the issue if Vega-Lite is at fault here. Maybe this is a delicate of vega/vega#286.

@domoritz domoritz transferred this issue from vega/vega-lite Oct 20, 2020
@jheer
Copy link
Member

jheer commented Oct 20, 2020

Some of the axis parameters simply do not support signal values, as those values are currently needed at compile time (part of the parsing and dataflow graph generation process). The Vega schema should indicate if signals are or are not supported, so I would check there. Any changes to make some of these properties dynamic may be possible, but likely would require some substantial engineering / refactoring effort.

@domoritz
Copy link
Member

We should make sure to only support expr for properties that support it then.

@domoritz domoritz transferred this issue from vega/vega Oct 20, 2020
@domoritz domoritz added Bug 🐛 P3 Should be fixed at some point labels Oct 20, 2020
@domoritz domoritz added this to the 5.x milestone Oct 20, 2020
@kanitw kanitw modified the milestones: 5.x, 5.0 Oct 25, 2020
@kanitw
Copy link
Member

kanitw commented Jan 4, 2021

The schema will be updated in #7148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 P3 Should be fixed at some point
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants