{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "style": "cell", "data": [ { "name": "source_0", "values": [ {"key": "alpha", "foo": [1, 2], "bar": ["A", "B"]}, {"key": "beta", "foo": [3, 4, 5], "bar": ["C", "D"]} ] }, { "name": "data_0", "source": "source_0", "transform": [ {"type": "flatten", "fields": ["foo", "bar"], "as": ["foo", "bar"]}, { "type": "filter", "expr": "isValid(datum[\"foo\"]) && isFinite(+datum[\"foo\"])" } ] } ], "signals": [ {"name": "y_step", "value": 20}, { "name": "height", "update": "bandspace(domain('y').length, 1, 0.5) * y_step" } ], "marks": [ { "name": "marks", "type": "symbol", "style": ["circle"], "from": {"data": "data_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"scale": "color", "field": "key"}, "ariaRoleDescription": {"value": "circle"}, "description": { "signal": "\"foo: \" + (format(datum[\"foo\"], \"\")) + \"; bar: \" + (isValid(datum[\"bar\"]) ? datum[\"bar\"] : \"\"+datum[\"bar\"]) + \"; key: \" + (isValid(datum[\"key\"]) ? datum[\"key\"] : \"\"+datum[\"key\"])" }, "x": {"scale": "x", "field": "foo"}, "y": {"scale": "y", "field": "bar"}, "shape": {"value": "circle"} } } } ], "scales": [ { "name": "x", "type": "linear", "domain": {"data": "data_0", "field": "foo"}, "range": [0, {"signal": "width"}], "nice": true, "zero": true }, { "name": "y", "type": "point", "domain": {"data": "data_0", "field": "bar", "sort": true}, "range": {"step": {"signal": "y_step"}}, "padding": 0.5 }, { "name": "color", "type": "ordinal", "domain": {"data": "data_0", "field": "key", "sort": true}, "range": "category" } ], "axes": [ { "scale": "x", "orient": "bottom", "gridScale": "y", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "x", "orient": "bottom", "grid": false, "title": "foo", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, {"scale": "y", "orient": "left", "grid": false, "title": "bar", "zindex": 0} ], "legends": [ { "fill": "color", "symbolType": "circle", "title": "key", "encode": {"symbols": {"update": {"opacity": {"value": 0.7}}}} } ] }