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

Merge parse and identical transforms at forks + allow sorting x/y-scale for layered plots #2177

Closed
domoritz opened this issue Apr 16, 2017 · 11 comments

Comments

@domoritz
Copy link
Member

Started in https://github.com/vega/vega-lite/tree/dom/parse-merge but it's still not correct.

@kanitw kanitw modified the milestone: 2.x.x - Dataflow Optimization May 4, 2017
@kanitw
Copy link
Member

kanitw commented Jun 14, 2017

  • overlay_line_short.vl.json is one example that needs this

@kanitw
Copy link
Member

kanitw commented Sep 7, 2017

@domoritz
Copy link
Member Author

domoritz commented Sep 7, 2017

In #2964 the two nodes are actually equivalent. We should definitely handle that case as it is trivial.

@kanitw kanitw changed the title Merge parse at forks Merge parse at forks + allow sorting x/y-scale for layered plots Oct 20, 2017
@kanitw kanitw assigned sirahd and unassigned AkshatSh Jan 16, 2018
@g3o2
Copy link
Contributor

g3o2 commented Mar 1, 2018

Given that there a few issues dealing with sorting in layered plots, some of them closed, I am bit confused regarding the status: is sorting x/y scale for layered plots work in progress ?

@domoritz
Copy link
Member Author

domoritz commented Mar 1, 2018

@g3o2 I think it's working. Do you have an example where it doesn't work?

@g3o2
Copy link
Contributor

g3o2 commented Mar 2, 2018

@domoritz maybe I'm doing something wrong ...

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "description": "A simple bar chart with embedded data.",
  "data": {
    "values": [
      {"a": "A","b": 28},
      {"a": "B","b": 55},
      {"a": "C","b": 43}
    ]
  },
  "layer": [{
    "mark": "bar",
    "encoding": {
      "y": {
        "field": "a", "type": "ordinal", 
        "sort": {"field": "b", "op": "mean", "order": "descending" }
      },
      "x": {"field": "b", "type": "quantitative"}
    }
  }, {
    "mark": {
      "type": "text",
      "align": "left",
      "baseline": "middle",
      "dx": 3
    },
    "encoding": {
      "y": {
        "field": "a", "type": "ordinal", 
        "sort": {"field": "b", "op": "mean", "order": "descending" }
      },
      "x": {"field": "b", "type": "quantitative"},
      "text": {"field": "b", "type": "quantitative"}
    }
  }]
}

image

@domoritz
Copy link
Member Author

domoritz commented Mar 2, 2018

@g3o2 As noted in #2964 (comment), it is not possible to union a scale domain with an aggregation other than count. However, in your case the data is coming from the same domain so the easy fix is to just use the one. However, layer creates a forked dataflow and we are currently not merging common subtrees (that's what this issue is about) and so Vega-Lite has no way of knowing that the two domains are actually the same (one may be filtered or otherwise transformed). You can sort with count aggregation or some other sort order but the spec above doesn't work yet. The fix will come!

@g3o2
Copy link
Contributor

g3o2 commented Mar 2, 2018

@domoritz thank you for clarifying!

@kanitw
Copy link
Member

kanitw commented May 24, 2018

#3797 also needs this.

@kanitw kanitw changed the title Merge parse at forks + allow sorting x/y-scale for layered plots Merge parse and identical transforms at forks + allow sorting x/y-scale for layered plots May 31, 2018
@kanitw
Copy link
Member

kanitw commented Jul 13, 2018

This is mostly addressed in #3959 except for merging identical transforms at forks

@quantoid
Copy link

quantoid commented Jan 2, 2024

@kanitw we're still seeing this issue when layering charts (in Altair 5.2.0) with sort="-x" on the y-axis.

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

No branches or pull requests

7 participants