{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "height": 200, "style": "cell", "data": [ { "name": "source_0", "values": [ {"category": "A", "group": "x", "value": 0.1}, {"category": "A", "group": "y", "value": 0.6}, {"category": "A", "group": "z", "value": 0.9}, {"category": "B", "group": "x", "value": 0.7}, {"category": "B", "group": "y", "value": 0.2}, {"category": "B", "group": "z", "value": 1.1}, {"category": "C", "group": "x", "value": 0.6}, {"category": "C", "group": "y", "value": 0.1}, {"category": "C", "group": "z", "value": 0.2} ] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"value\"]) && isFinite(+datum[\"value\"])" } ] } ], "signals": [ {"name": "x_step", "update": "20 * domain('xOffset').length / (1-0.2)"}, { "name": "width", "update": "bandspace(domain('x').length, 0.2, 0.2) * x_step" } ], "marks": [ { "name": "marks", "type": "symbol", "style": ["point"], "from": {"data": "data_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"scale": "color", "field": "group"}, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"category: \" + (isValid(datum[\"category\"]) ? datum[\"category\"] : \"\"+datum[\"category\"]) + \"; value: \" + (format(datum[\"value\"], \"\")) + \"; group: \" + (isValid(datum[\"group\"]) ? datum[\"group\"] : \"\"+datum[\"group\"])" }, "x": { "scale": "x", "field": "category", "offset": {"scale": "xOffset", "field": "group"} }, "y": {"scale": "y", "field": "value"} } } } ], "scales": [ { "name": "x", "type": "band", "domain": {"data": "data_0", "field": "category", "sort": true}, "range": {"step": {"signal": "x_step"}}, "paddingInner": 0.2, "paddingOuter": 0.2 }, { "name": "y", "type": "linear", "domain": {"data": "data_0", "field": "value"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true }, { "name": "xOffset", "type": "point", "domain": {"data": "data_0", "field": "group", "sort": true}, "range": {"step": 20}, "paddingOuter": 0.5 }, { "name": "color", "type": "ordinal", "domain": {"data": "data_0", "field": "group", "sort": true}, "range": "category" } ], "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": "category", "labelAlign": "right", "labelAngle": 270, "labelBaseline": "middle", "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "value", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ], "legends": [ { "stroke": "color", "symbolType": "circle", "title": "group", "encode": { "symbols": { "update": { "fill": {"value": "transparent"}, "opacity": {"value": 0.7} } } } } ] }