Alex Craft
Alex Craft

Reputation: 15386

How to add `minExtent` in VegaLite when there's no Y axis?

The minExtent has no effect on Vega Lite Chart if there's no Y axis. Is there other way to shift chart to the left in order to align multiple charts properly.

Example and playground, the minExtent has no effect on the chart:

enter image description here

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"url": "data/cars.json"},
  "mark": "tick",
  "encoding": {"x": {"field": "Horsepower", "type": "quantitative"}},
  "config": {
    "tick": {"thickness": 2, "bandSize": 10},
    "axisY": {"minExtent": 100}
  }
}

The actual problem, I can't align the second chart, it's misaligned and shifted to the left.

enter image description here

Upvotes: 2

Views: 15

Answers (1)

davidebacci
davidebacci

Reputation: 30324

Force it like this:

enter image description here

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"url": "data/cars.json"}, "height":30,
  "mark": {"type": "tick", "height":30},
  "encoding": {"x": {"field": "Horsepower", "type": "quantitative"}, "y":{"datum":0 }}, 
  "config": {
    "tick": {"thickness": 2, "bandSize": 10},
    "axisY": {"minExtent": 100, }
  }
}

Upvotes: 1

Related Questions