{ "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "description": "A vertically oriented funnel chart with centered bars and labels", "data": { "values": [ {"stage": "Stage 1", "value": 1000}, {"stage": "Stage 2", "value": 750}, {"stage": "Stage 3", "value": 500}, {"stage": "Stage 4", "value": 800}, {"stage": "Stage 5", "value": 100} ] }, "transform": [ { "window": [{"op": "max", "field": "value", "as": "max_value"}] }, { "calculate": "(datum.max_value - datum.value) / 2", "as": "start" }, { "calculate": "datum.start + datum.value", "as": "end" } ], "layer": [ { "mark": "bar", "encoding": { "y": { "field": "start", "type": "quantitative", "axis": null }, "y2": { "field": "end", "type": "quantitative" }, "x": { "field": "stage", "type": "ordinal", "sort": {"field": "value", "order": "descending"}, "axis": null }, "color": { "field": "stage", "type": "nominal", "legend": {"title": "Stages"} } } }, { "mark": { "type": "text", "align": "center", "baseline": "middle", "dx": 0 }, "encoding": { "y": { "calculate": "(datum.start + datum.end) / 2", "type": "quantitative" }, "x": { "field": "stage", "type": "ordinal" }, "text": { "field": "value", "type": "quantitative" } } } ] }