diff --git a/examples/compiled/bar_conditional_opacity.png b/examples/compiled/bar_conditional_opacity.png new file mode 100644 index 0000000000..457b6045ec Binary files /dev/null and b/examples/compiled/bar_conditional_opacity.png differ diff --git a/examples/compiled/bar_conditional_opacity.svg b/examples/compiled/bar_conditional_opacity.svg new file mode 100644 index 0000000000..83121d3d5b --- /dev/null +++ b/examples/compiled/bar_conditional_opacity.svg @@ -0,0 +1 @@ +a2c1c2c3C20102030405060708090Q1_Null \ No newline at end of file diff --git a/examples/compiled/bar_conditional_opacity.vg.json b/examples/compiled/bar_conditional_opacity.vg.json new file mode 100644 index 0000000000..34267691ff --- /dev/null +++ b/examples/compiled/bar_conditional_opacity.vg.json @@ -0,0 +1,116 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "width": 400, + "height": 400, + "style": "cell", + "data": [ + { + "name": "source_0", + "values": [ + {"Q1_Null": null, "C2": "a1"}, + {"Q1_Null": null, "C2": "b1"}, + {"Q1_Null": 82.3, "C2": "c1"}, + {"Q1_Null": 41.1, "C2": "a2"}, + {"Q1_Null": 31.1, "C2": "a2"}, + {"Q1_Null": 15.1, "C2": "c2"}, + {"Q1_Null": 48.1, "C2": "c3"}, + {"Q1_Null": null, "C2": "c4"} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + { + "type": "stack", + "groupby": ["C2"], + "field": "Q1_Null", + "sort": {"field": [], "order": []}, + "as": ["Q1_Null_start", "Q1_Null_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"Q1_Null\"]) && isFinite(+datum[\"Q1_Null\"])" + } + ] + } + ], + "marks": [ + { + "name": "layer_0_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "opacity": {"test": "true", "value": 0.2}, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"C2: \" + (isValid(datum[\"C2\"]) ? datum[\"C2\"] : \"\"+datum[\"C2\"]) + \"; Q1_Null: \" + (format(datum[\"Q1_Null\"], \"\"))" + }, + "x": {"scale": "x", "field": "C2"}, + "width": {"signal": "max(0.25, bandwidth('x'))"}, + "y": {"scale": "y", "field": "Q1_Null_end"}, + "y2": {"scale": "y", "field": "Q1_Null_start"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "band", + "domain": {"data": "data_0", "field": "C2", "sort": true}, + "range": [0, {"signal": "width"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "y", + "type": "linear", + "domain": {"data": "data_0", "fields": ["Q1_Null_start", "Q1_Null_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": "C2", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Q1_Null", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] +}