{ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": { "url": "https://vega.github.io/vega-lite/data/cars.json" }, "encoding": { "color": { "field": "Origin", "type": "nominal" }, "opacity": { "field": "Cylinders", "legend": null, "type": "quantitative" }, "tooltip": [ { "field": "Origin", "type": "nominal" }, { "field": "Cylinders", "type": "quantitative" } ], "x": { "axis": null, "field": "x", "type": "quantitative" }, "x2": { "field": "x2" }, "y": { "axis": null, "field": "y", "type": "quantitative" }, "y2": { "field": "y2" } }, "mark": "rect", "transform": [ { "aggregate": [ { "as": "count_*", "op": "count" } ], "groupby": [ "Origin", "Cylinders" ] }, { "as": [ "stack_count_Origin1", "stack_count_Origin2" ], "groupby": [], "offset": "normalize", "sort": [ { "field": "Origin", "order": "ascending" } ], "stack": "count_*" }, { "frame": [ null, null ], "groupby": [ "Origin" ], "window": [ { "as": "x", "field": "stack_count_Origin1", "op": "min" }, { "as": "x2", "field": "stack_count_Origin2", "op": "max" } ] }, { "as": [ "y", "y2" ], "groupby": [ "Origin" ], "offset": "normalize", "sort": [ { "field": "Cylinders", "order": "ascending" } ], "stack": "count_*" } ] }