Gotcha. Well, I adapted the grouped-bar example, got rid of the faceted transform and did some "manual" banding. That seems to do the trick as long as you know which data is always going to be larger at each point:
{
"width": 300,
"height": 240,
"data": [
{
"name": "original",
"url": "data/groups.json"
},
{
"name": "one",
"source": "original",
"transform": [
{"type":"filter", "test":"d.data.position === 1"}
]
},
{
"name": "two",
"source": "original",
"transform": [
{"type":"filter", "test":"d.data.position === 2"}
]
}
],
"scales": [
{
"name": "cat",
"type": "ordinal",
"range": "height",
"padding": 0.2,
"domain": {"data": "two", "field": "data.category"}
},
{
"name": "val",
"range": "width",
"round": true,
"nice": true,
"domain": {"data": "two", "field": "data.value"}
},
{
"name": "color",
"type": "ordinal",
"range": "category20"
}
],
"axes": [
{"type": "y", "scale": "cat", "tickSize": 0, "tickPadding": 8},
{"type": "x", "scale": "val"}
],
"marks": [
{
"type": "rect",
"from": {"data": "two"},
"properties": {
"enter": {
"y": {"scale": "cat", "field": "data.category"},
"height": {"scale": "cat", "band": true},
"x": {"scale": "val", "field": "data.value"},
"x2": {"scale": "val", "value": 0},
"fill": {"scale": "color", "field": "data.position"}
}
}
},
{
"type": "rect",
"from": {"data": "one"},
"properties": {
"enter": {
"y": {"scale": "cat", "field": "data.category", "offset": 10},
"height": {"scale": "cat", "band": true, "offset": -20},
"x": {"scale": "val", "field": "data.value"},
"x2": {"scale": "val", "value": 0},
"fill": {"scale": "color", "field": "data.position"}
}
}
}
]
}