Skip to content

Sort encoding doesn't work correctly on layered plots #5057

Open

Description

{
  "data": {
    "values": [
      {"name": "a", "val": 2, "highlight": 1, 
       "lower": 1.5,"upper": 2.5},
      {"name": "c", "val": 1, "highlight": 0,
      "lower": 0.5,"upper": 1.5},
      {"name": "b", "val": 3, "highlight": 0,
      "lower": 2.5,"upper": 3.5}
    ]
  },
  "layer": [
    {
      "mark": "bar",
      "encoding": {
        
        "y": {
          "field": "name",
          "type": "ordinal",
          "sort": {"encoding": "x"}
        },
        "x": {"field": "val", "type": "quantitative"}
      }
    },
    {
      "mark": "rule",
      "encoding": {
        "x": {
          "field": "upper",
          "type": "quantitative",
          "scale": {"zero": false}
        },
        "x2": {"field": "lower", "type": "quantitative"},
        "y": {
          "field": "name",
          "type": "ordinal",
          "sort":  {"encoding": "x"}
        }
      }
    }
  ]
}

This is discovered from experimenting with the example in this comment.

It seems like there are multiple underlying issues.

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions