Does vega-lite Having Fixed Y-axis?

368 Views Asked by At

I have 2 charts which might have been created using hconcat. The first spec contains only an y-axis which is going to be fixed and it will act as a locked axis for my 2nd chart. If I scroll horizontally, it should only scroll the 2nd chart and my 1st y-axis chart should remain as it is, so it becomes easier to read the measures.

Below is an reproducible example or refer editor:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"url": "data/cars.json"},
  "hconcat": [
    {
      "mark": "text",
      "encoding": {"y": {"field": "Displacement", "type": "quantitative"}}
    },
    {
      "hconcat": [
        {
          "width": 800,
          "mark": "line",
          "params": [
            {
              "name": "brush",
              "select": {"type": "interval", "encodings": ["x"]}
            }
          ],
          "encoding": {
            "x": {"field": "Year", "type": "temporal"},
            "y": {
              "field": "Cylinders",
              "type": "quantitative",
              "axis": {"grid": false}
            }
          }
        }
      ]
    }
  ]
}

This image contains Y-axis on left side

This contains only x-axis,Y-axis disappeared

0

There are 0 best solutions below