{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "height": 200, "style": "cell", "data": [ { "name": "specialchars", "values": [ {"pe.riods": "a.b", "bracket[values": "[1]"}, {"pe.riods": "c.d", "bracket[values": "[2]"}, {"pe.riods": "e.f", "bracket[values": "[2]"}, {"pe.riods": "e.f", "bracket[values": "[2]"} ] }, { "name": "data_1", "source": "specialchars", "transform": [ { "type": "formula", "expr": "datum[\"pe.riods\"]===\"a.b\" ? 0 : datum[\"pe.riods\"]===\"c.d\" ? 1 : datum[\"pe.riods\"]===\"e.f\" ? 2 : 3", "as": "color_pe.riods_sort_index" } ] }, { "name": "data_2", "source": "data_1", "transform": [ { "type": "aggregate", "groupby": ["pe\\.riods"], "ops": ["count"], "fields": [null], "as": ["__count"] } ] }, { "name": "data_3", "source": "specialchars", "transform": [ { "type": "aggregate", "groupby": ["pe\\.riods"], "ops": [], "fields": [], "as": [] }, { "type": "window", "params": [null], "as": ["rank"], "ops": ["rank"], "fields": [null], "sort": {"field": [], "order": []} }, {"type": "filter", "expr": "datum.rank <= 21"} ] } ], "signals": [ {"name": "x_step", "value": 20}, { "name": "width", "update": "bandspace(domain('x').length, 0.1, 0.05) * x_step" } ], "marks": [ { "name": "layer_0_layer_0_layer_0_marks", "type": "rect", "clip": true, "style": ["bar"], "from": {"data": "data_2"}, "encode": { "update": { "fill": {"scale": "layer_0_layer_0_color", "field": "pe\\.riods"}, "opacity": {"value": 1}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"pe.riods: \" + (isValid(datum[\"pe.riods\"]) ? datum[\"pe.riods\"] : \"\"+datum[\"pe.riods\"]) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" }, "x": {"scale": "x", "field": "pe\\.riods"}, "width": {"signal": "max(0.25, bandwidth('x'))"}, "y": {"scale": "y", "field": "__count"}, "y2": {"scale": "y", "value": 0} } } }, { "name": "aggregate_xAxis_spec_967cacb2_18eb_422b_9030_a57a4b3ee080_marks", "type": "rule", "clip": true, "style": ["rule"], "from": {"data": "data_3"}, "encode": {"update": {}} }, { "name": "aggregate_color_spec_967cacb2_18eb_422b_9030_a57a4b3ee080_marks", "type": "rule", "clip": true, "style": ["rule"], "from": {"data": "data_3"}, "encode": {"update": {}} } ], "scales": [ { "name": "x", "type": "band", "domain": {"data": "data_2", "field": "pe\\.riods", "sort": true}, "range": {"step": {"signal": "x_step"}}, "paddingInner": 0.1, "paddingOuter": 0.05 }, { "name": "y", "type": "linear", "domain": {"data": "data_2", "field": "__count"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true }, { "name": "layer_0_layer_0_color", "type": "ordinal", "domain": { "data": "data_1", "field": "pe\\.riods", "sort": {"op": "min", "field": "color_pe\\.riods_sort_index"} }, "range": [ "#4C78A8", "#F58518", "#E45756", "#72B7B2", "#54A24B", "#EECA3B", "#B279A2", "#FF9DA6", "#9D755D", "#BAB0AC" ], "interpolate": "hcl" } ], "axes": [ { "scale": "x", "orient": "bottom", "grid": true, "gridScale": "y", "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": true, "gridScale": "x", "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": "pe.riods", "labels": true, "ticks": true, "labelAlign": "right", "labelAngle": 270, "labelBaseline": "middle", "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "Count of Records", "labels": true, "ticks": true, "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ], "legends": [ { "symbolOpacity": 1, "title": "pe.riods", "fill": "layer_0_layer_0_color", "symbolType": "square" } ], "config": {"legend": {"orient": "right"}}, "usermeta": {"selectionConfigs": {}} }