0

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

wahab memon
  • 2,193
  • 2
  • 10
  • 23
  • I don't entirely follow your question, but it sounds like you might want a dual axis? This example might be helpful: https://vega.github.io/vega-lite/examples/layer_dual_axis.html – jakevdp Sep 27 '21 at 19:12
  • No @jakevdp. I want the Fixed Y-axis on the left side.If more data shows, on scrolling the x-axis the y-axis disappeared. – Pon_Balaji_P Sep 28 '21 at 05:52
  • I'm sorry, I do not understand. Perhaps editing your question to add a minimal example would help. – jakevdp Sep 28 '21 at 13:47

0 Answers0