I'm trying to make a simple stacked bar chart, only on the X axis. I have it working, with two values of 50, and 250. So the max of the X axis shows as 300.
How do I force that to another value, like 500? So there is a gap from the last value, to the end of the axis?
In assuming it is via a scale domain somehow? I'm having a tough time understanding all of the options.
You can set the axis limits using the scale domain. Here is an example (vega editor link):
{
"data": {"values": [{"x": 50, "c": 1}, {"x": 250, "c": 2}]},
"mark": "bar",
"encoding": {
"x": {"field": "x", "type": "quantitative", "scale": {"domain": [0, 500]}},
"color": {"field": "c", "type": "ordinal"}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With