{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Nested concatenation aligned by setting axis minExtent", "background": "white", "padding": 5, "data": [ { "name": "source_0", "url": "data/movies.json", "format": {"type": "json"}, "transform": [ { "type": "extent", "field": "Worldwide Gross", "signal": "child__column_Worldwide_Gross_bin_maxbins_20_Worldwide_Gross_extent" }, { "type": "bin", "field": "Worldwide Gross", "as": [ "bin_maxbins_20_Worldwide Gross", "bin_maxbins_20_Worldwide Gross_end" ], "signal": "child__column_Worldwide_Gross_bin_maxbins_20_Worldwide_Gross_bins", "extent": { "signal": "child__column_Worldwide_Gross_bin_maxbins_20_Worldwide_Gross_extent" }, "maxbins": 20 }, { "type": "extent", "field": "Rotten Tomatoes Rating", "signal": "child__column_Rotten_Tomatoes_Rating_bin_maxbins_20_Rotten_Tomatoes_Rating_extent" }, { "type": "bin", "field": "Rotten Tomatoes Rating", "as": [ "bin_maxbins_20_Rotten Tomatoes Rating", "bin_maxbins_20_Rotten Tomatoes Rating_end" ], "signal": "child__column_Rotten_Tomatoes_Rating_bin_maxbins_20_Rotten_Tomatoes_Rating_bins", "extent": { "signal": "child__column_Rotten_Tomatoes_Rating_bin_maxbins_20_Rotten_Tomatoes_Rating_extent" }, "maxbins": 20 }, { "type": "extent", "field": "IMDB Rating", "signal": "child__column_IMDB_Rating_bin_maxbins_20_IMDB_Rating_extent" }, { "type": "bin", "field": "IMDB Rating", "as": [ "bin_maxbins_20_IMDB Rating", "bin_maxbins_20_IMDB Rating_end" ], "signal": "child__column_IMDB_Rating_bin_maxbins_20_IMDB_Rating_bins", "extent": { "signal": "child__column_IMDB_Rating_bin_maxbins_20_IMDB_Rating_extent" }, "maxbins": 20 }, { "type": "extent", "field": "US Gross", "signal": "child__column_US_Gross_bin_maxbins_20_US_Gross_extent" }, { "type": "bin", "field": "US Gross", "as": ["bin_maxbins_20_US Gross", "bin_maxbins_20_US Gross_end"], "signal": "child__column_US_Gross_bin_maxbins_20_US_Gross_bins", "extent": { "signal": "child__column_US_Gross_bin_maxbins_20_US_Gross_extent" }, "maxbins": 20 } ] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": [ "bin_maxbins_20_Worldwide Gross", "bin_maxbins_20_Worldwide Gross_end" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_20_Worldwide Gross\"]) && isFinite(+datum[\"bin_maxbins_20_Worldwide Gross\"])" } ] }, { "name": "data_1", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": [ "bin_maxbins_20_Rotten Tomatoes Rating", "bin_maxbins_20_Rotten Tomatoes Rating_end" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_20_Rotten Tomatoes Rating\"]) && isFinite(+datum[\"bin_maxbins_20_Rotten Tomatoes Rating\"])" } ] }, { "name": "data_2", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": [ "bin_maxbins_20_IMDB Rating", "bin_maxbins_20_IMDB Rating_end" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_20_IMDB Rating\"]) && isFinite(+datum[\"bin_maxbins_20_IMDB Rating\"])" } ] }, { "name": "data_3", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": ["bin_maxbins_20_US Gross", "bin_maxbins_20_US Gross_end"], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_20_US Gross\"]) && isFinite(+datum[\"bin_maxbins_20_US Gross\"])" } ] } ], "signals": [ {"name": "concat_0_childWidth", "value": 150}, {"name": "concat_0_childHeight", "value": 50}, {"name": "concat_1_childWidth", "value": 150}, {"name": "concat_1_childHeight", "value": 50} ], "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", "name": "concat_0_group", "title": {"text": "Ratings", "anchor": "start"}, "layout": {"padding": 20, "columns": 2, "bounds": "full", "align": "all"}, "marks": [ { "type": "group", "name": "child__column_Rotten_Tomatoes_Rating_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_0_childWidth"}, "height": {"signal": "concat_0_childHeight"} } }, "marks": [ { "name": "child__column_Rotten_Tomatoes_Rating_marks", "type": "rect", "style": ["bar"], "from": {"data": "data_1"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Rotten Tomatoes Rating (binned): \" + (!isValid(datum[\"bin_maxbins_20_Rotten Tomatoes Rating\"]) || !isFinite(+datum[\"bin_maxbins_20_Rotten Tomatoes Rating\"]) ? \"null\" : format(datum[\"bin_maxbins_20_Rotten Tomatoes Rating\"], \"\") + \" – \" + format(datum[\"bin_maxbins_20_Rotten Tomatoes Rating_end\"], \"\")) + \"; Count: \" + (format(datum[\"__count\"], \"\"))" }, "x2": { "scale": "child__column_Rotten_Tomatoes_Rating_x", "field": "bin_maxbins_20_Rotten Tomatoes Rating", "offset": 1 }, "x": { "scale": "child__column_Rotten_Tomatoes_Rating_x", "field": "bin_maxbins_20_Rotten Tomatoes Rating_end" }, "y": { "scale": "child__column_Rotten_Tomatoes_Rating_y", "field": "__count" }, "y2": { "scale": "child__column_Rotten_Tomatoes_Rating_y", "value": 0 } } } } ], "axes": [ { "scale": "child__column_Rotten_Tomatoes_Rating_y", "orient": "left", "gridScale": "child__column_Rotten_Tomatoes_Rating_x", "grid": true, "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_Rotten_Tomatoes_Rating_x", "orient": "bottom", "grid": false, "title": "Rotten Tomatoes Rating (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_0_childWidth/10)"}, "zindex": 0 }, { "scale": "child__column_Rotten_Tomatoes_Rating_y", "orient": "left", "grid": false, "title": "Count", "labelOverlap": true, "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__column_IMDB_Rating_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_0_childWidth"}, "height": {"signal": "concat_0_childHeight"} } }, "marks": [ { "name": "child__column_IMDB_Rating_marks", "type": "rect", "style": ["bar"], "from": {"data": "data_2"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"IMDB Rating (binned): \" + (!isValid(datum[\"bin_maxbins_20_IMDB Rating\"]) || !isFinite(+datum[\"bin_maxbins_20_IMDB Rating\"]) ? \"null\" : format(datum[\"bin_maxbins_20_IMDB Rating\"], \"\") + \" – \" + format(datum[\"bin_maxbins_20_IMDB Rating_end\"], \"\")) + \"; Count: \" + (format(datum[\"__count\"], \"\"))" }, "x2": { "scale": "child__column_IMDB_Rating_x", "field": "bin_maxbins_20_IMDB Rating", "offset": 1 }, "x": { "scale": "child__column_IMDB_Rating_x", "field": "bin_maxbins_20_IMDB Rating_end" }, "y": { "scale": "child__column_IMDB_Rating_y", "field": "__count" }, "y2": {"scale": "child__column_IMDB_Rating_y", "value": 0} } } } ], "axes": [ { "scale": "child__column_IMDB_Rating_y", "orient": "left", "gridScale": "child__column_IMDB_Rating_x", "grid": true, "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_IMDB_Rating_x", "orient": "bottom", "grid": false, "title": "IMDB Rating (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_0_childWidth/10)"}, "zindex": 0 }, { "scale": "child__column_IMDB_Rating_y", "orient": "left", "grid": false, "title": "Count", "labelOverlap": true, "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, "zindex": 0 } ] } ] }, { "type": "group", "name": "concat_1_group", "title": {"text": "Gross", "anchor": "start"}, "layout": {"padding": 20, "columns": 2, "bounds": "full", "align": "all"}, "marks": [ { "type": "group", "name": "child__column_US_Gross_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_1_childWidth"}, "height": {"signal": "concat_1_childHeight"} } }, "marks": [ { "name": "child__column_US_Gross_marks", "type": "rect", "style": ["bar"], "from": {"data": "data_3"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"US Gross (binned): \" + (!isValid(datum[\"bin_maxbins_20_US Gross\"]) || !isFinite(+datum[\"bin_maxbins_20_US Gross\"]) ? \"null\" : format(datum[\"bin_maxbins_20_US Gross\"], \"\") + \" – \" + format(datum[\"bin_maxbins_20_US Gross_end\"], \"\")) + \"; Count: \" + (format(datum[\"__count\"], \"\"))" }, "x2": { "scale": "child__column_US_Gross_x", "field": "bin_maxbins_20_US Gross", "offset": 1 }, "x": { "scale": "child__column_US_Gross_x", "field": "bin_maxbins_20_US Gross_end" }, "y": { "scale": "child__column_US_Gross_y", "field": "__count" }, "y2": {"scale": "child__column_US_Gross_y", "value": 0} } } } ], "axes": [ { "scale": "child__column_US_Gross_y", "orient": "left", "gridScale": "child__column_US_Gross_x", "grid": true, "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_US_Gross_x", "orient": "bottom", "grid": false, "title": "US Gross (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_1_childWidth/10)"}, "zindex": 0 }, { "scale": "child__column_US_Gross_y", "orient": "left", "grid": false, "title": "Count", "labelOverlap": true, "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__column_Worldwide_Gross_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_1_childWidth"}, "height": {"signal": "concat_1_childHeight"} } }, "marks": [ { "name": "child__column_Worldwide_Gross_marks", "type": "rect", "style": ["bar"], "from": {"data": "data_0"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Worldwide Gross (binned): \" + (!isValid(datum[\"bin_maxbins_20_Worldwide Gross\"]) || !isFinite(+datum[\"bin_maxbins_20_Worldwide Gross\"]) ? \"null\" : format(datum[\"bin_maxbins_20_Worldwide Gross\"], \"\") + \" – \" + format(datum[\"bin_maxbins_20_Worldwide Gross_end\"], \"\")) + \"; Count: \" + (format(datum[\"__count\"], \"\"))" }, "x2": { "scale": "child__column_Worldwide_Gross_x", "field": "bin_maxbins_20_Worldwide Gross", "offset": 1 }, "x": { "scale": "child__column_Worldwide_Gross_x", "field": "bin_maxbins_20_Worldwide Gross_end" }, "y": { "scale": "child__column_Worldwide_Gross_y", "field": "__count" }, "y2": {"scale": "child__column_Worldwide_Gross_y", "value": 0} } } } ], "axes": [ { "scale": "child__column_Worldwide_Gross_y", "orient": "left", "gridScale": "child__column_Worldwide_Gross_x", "grid": true, "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_Worldwide_Gross_x", "orient": "bottom", "grid": false, "title": "Worldwide Gross (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_1_childWidth/10)"}, "zindex": 0 }, { "scale": "child__column_Worldwide_Gross_y", "orient": "left", "grid": false, "title": "Count", "labelOverlap": true, "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, "zindex": 0 } ] } ] } ], "scales": [ { "name": "child__column_Rotten_Tomatoes_Rating_x", "type": "linear", "domain": { "signal": "[child__column_Rotten_Tomatoes_Rating_bin_maxbins_20_Rotten_Tomatoes_Rating_bins.start, child__column_Rotten_Tomatoes_Rating_bin_maxbins_20_Rotten_Tomatoes_Rating_bins.stop]" }, "range": [0, {"signal": "concat_0_childWidth"}], "bins": { "signal": "child__column_Rotten_Tomatoes_Rating_bin_maxbins_20_Rotten_Tomatoes_Rating_bins" }, "zero": false }, { "name": "child__column_Rotten_Tomatoes_Rating_y", "type": "linear", "domain": {"data": "data_1", "field": "__count"}, "range": [{"signal": "concat_0_childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__column_IMDB_Rating_x", "type": "linear", "domain": { "signal": "[child__column_IMDB_Rating_bin_maxbins_20_IMDB_Rating_bins.start, child__column_IMDB_Rating_bin_maxbins_20_IMDB_Rating_bins.stop]" }, "range": [0, {"signal": "concat_0_childWidth"}], "bins": { "signal": "child__column_IMDB_Rating_bin_maxbins_20_IMDB_Rating_bins" }, "zero": false }, { "name": "child__column_IMDB_Rating_y", "type": "linear", "domain": {"data": "data_2", "field": "__count"}, "range": [{"signal": "concat_0_childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__column_US_Gross_x", "type": "linear", "domain": { "signal": "[child__column_US_Gross_bin_maxbins_20_US_Gross_bins.start, child__column_US_Gross_bin_maxbins_20_US_Gross_bins.stop]" }, "range": [0, {"signal": "concat_1_childWidth"}], "bins": {"signal": "child__column_US_Gross_bin_maxbins_20_US_Gross_bins"}, "zero": false }, { "name": "child__column_US_Gross_y", "type": "linear", "domain": {"data": "data_3", "field": "__count"}, "range": [{"signal": "concat_1_childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__column_Worldwide_Gross_x", "type": "linear", "domain": { "signal": "[child__column_Worldwide_Gross_bin_maxbins_20_Worldwide_Gross_bins.start, child__column_Worldwide_Gross_bin_maxbins_20_Worldwide_Gross_bins.stop]" }, "range": [0, {"signal": "concat_1_childWidth"}], "bins": { "signal": "child__column_Worldwide_Gross_bin_maxbins_20_Worldwide_Gross_bins" }, "zero": false }, { "name": "child__column_Worldwide_Gross_y", "type": "linear", "domain": {"data": "data_0", "field": "__count"}, "range": [{"signal": "concat_1_childHeight"}, 0], "nice": true, "zero": true } ], "config": {"axisX": {"titleLimit": 150}, "axisY": {"minExtent": 40}} }