{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "data": [ { "name": "source_0", "url": "https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json", "format": {"type": "json"}, "transform": [ { "type": "extent", "field": "Horsepower", "signal": "child_bin_maxbins_15_Horsepower_extent" }, { "type": "bin", "field": "Horsepower", "as": ["bin_maxbins_15_Horsepower", "bin_maxbins_15_Horsepower_end"], "signal": "child_bin_maxbins_15_Horsepower_bins", "extent": {"signal": "child_bin_maxbins_15_Horsepower_extent"}, "maxbins": 15 }, { "type": "aggregate", "groupby": [ "bin_maxbins_15_Horsepower", "bin_maxbins_15_Horsepower_end", "Origin" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_15_Horsepower\"]) && isFinite(+datum[\"bin_maxbins_15_Horsepower\"])" } ] }, { "name": "row_domain", "source": "source_0", "transform": [{"type": "aggregate", "groupby": ["Origin"]}] } ], "signals": [ {"name": "child_width", "value": 200}, {"name": "child_height", "value": 200} ], "layout": { "padding": 20, "offset": {"rowTitle": 10}, "columns": 1, "bounds": "full", "align": "all" }, "marks": [ { "name": "row-title", "type": "group", "role": "row-title", "title": { "text": "Origin", "orient": "left", "style": "guide-title", "offset": 10 } }, { "name": "row_header", "type": "group", "role": "row-header", "from": {"data": "row_domain"}, "sort": {"field": "datum[\"Origin\"]", "order": "ascending"}, "title": { "text": { "signal": "isValid(parent[\"Origin\"]) ? parent[\"Origin\"] : \"\"+parent[\"Origin\"]" }, "orient": "left", "style": "guide-label", "frame": "group", "offset": 10 }, "encode": {"update": {"height": {"signal": "child_height"}}}, "axes": [ { "scale": "y", "orient": "left", "grid": false, "title": "Count of Records", "labelOverlap": true, "tickCount": {"signal": "ceil(child_height/40)"}, "zindex": 0 } ] }, { "name": "column_footer", "type": "group", "role": "column-footer", "encode": {"update": {"width": {"signal": "child_width"}}}, "axes": [ { "scale": "x", "orient": "bottom", "grid": false, "title": "Horsepower (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(child_width/10)"}, "zindex": 0 } ] }, { "name": "cell", "type": "group", "style": "cell", "from": { "facet": {"name": "facet", "data": "source_0", "groupby": ["Origin"]} }, "sort": {"field": ["datum[\"Origin\"]"], "order": ["ascending"]}, "encode": { "update": { "width": {"signal": "child_width"}, "height": {"signal": "child_height"} } }, "marks": [ { "name": "child_marks", "type": "rect", "style": ["bar"], "from": {"data": "facet"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Horsepower (binned): \" + (!isValid(datum[\"bin_maxbins_15_Horsepower\"]) || !isFinite(+datum[\"bin_maxbins_15_Horsepower\"]) ? \"null\" : format(datum[\"bin_maxbins_15_Horsepower\"], \"\") + \" – \" + format(datum[\"bin_maxbins_15_Horsepower_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" }, "x2": [ { "test": "!isValid(datum[\"bin_maxbins_15_Horsepower\"]) || !isFinite(+datum[\"bin_maxbins_15_Horsepower\"])", "value": 0 }, { "scale": "x", "field": "bin_maxbins_15_Horsepower", "offset": 1 } ], "x": [ { "test": "!isValid(datum[\"bin_maxbins_15_Horsepower\"]) || !isFinite(+datum[\"bin_maxbins_15_Horsepower\"])", "value": 0 }, {"scale": "x", "field": "bin_maxbins_15_Horsepower_end"} ], "y": {"scale": "y", "field": "__count"}, "y2": {"scale": "y", "value": 0} } } } ], "axes": [ { "scale": "y", "orient": "left", "gridScale": "x", "grid": true, "tickCount": {"signal": "ceil(child_height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 } ] } ], "scales": [ { "name": "x", "type": "linear", "domain": { "signal": "[child_bin_maxbins_15_Horsepower_bins.start, child_bin_maxbins_15_Horsepower_bins.stop]" }, "range": [0, {"signal": "child_width"}], "bins": {"signal": "child_bin_maxbins_15_Horsepower_bins"}, "zero": false }, { "name": "y", "type": "linear", "domain": {"data": "source_0", "field": "__count"}, "range": [{"signal": "child_height"}, 0], "nice": true, "zero": true } ] }