{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "height": 200, "style": "cell", "data": [ { "name": "source_0", "values": [ {"bin_start": 8, "bin_end": 10, "count": 7}, {"bin_start": 10, "bin_end": 12, "count": 29}, {"bin_start": 12, "bin_end": 14, "count": 71}, {"bin_start": 14, "bin_end": 16, "count": 127}, {"bin_start": 16, "bin_end": 18, "count": 94}, {"bin_start": 18, "bin_end": 20, "count": 54}, {"bin_start": 20, "bin_end": 22, "count": 17}, {"bin_start": 22, "bin_end": 24, "count": 5} ] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "stack", "groupby": ["bin_start", "bin_start"], "field": "count", "sort": {"field": [], "order": []}, "as": ["count_start", "count_end"], "offset": "zero" }, { "type": "filter", "expr": "isValid(datum[\"bin_start\"]) && isFinite(+datum[\"bin_start\"]) && isValid(datum[\"count\"]) && isFinite(+datum[\"count\"])" } ] } ], "marks": [ { "name": "marks", "type": "rect", "style": ["bar"], "from": {"data": "data_0"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"bin_start: \" + (!isValid(datum[\"bin_start\"]) || !isFinite(+datum[\"bin_start\"]) ? \"null\" : format(datum[\"bin_start\"], \"\") + \" – \" + format(datum[\"bin_end\"], \"\")) + \"; count: \" + (format(datum[\"count\"], \"\"))" }, "x2": {"scale": "x", "field": "bin_start", "offset": 1}, "x": {"scale": "x", "field": "bin_end"}, "y": {"scale": "y", "field": "count_end"}, "y2": {"scale": "y", "field": "count_start"} } } } ], "scales": [ { "name": "x", "type": "linear", "domain": {"data": "data_0", "fields": ["bin_start", "bin_end"]}, "range": [0, {"signal": "width"}], "bins": {"step": 2}, "zero": false }, { "name": "y", "type": "linear", "domain": {"data": "data_0", "fields": ["count_start", "count_end"]}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true } ], "axes": [ { "scale": "y", "orient": "left", "gridScale": "x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "x", "orient": "bottom", "grid": false, "title": "bin_start, bin_end", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "count", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }