{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "height": 200, "style": "cell", "data": [ { "name": "movies", "url": "https://cdn.jsdelivr.net/npm/vega-datasets@v1.29.0/data/movies.json", "format": {"type": "json"}, "transform": [ { "type": "extent", "field": "IMDB_Rating", "signal": "layer_0_layer_0_bin_maxbins_10_IMDB_Rating_extent" }, { "type": "bin", "field": "IMDB_Rating", "as": ["__bin_field_name", "__bin_field_name_end"], "signal": "layer_0_layer_0_bin_maxbins_10_IMDB_Rating_bins", "extent": { "signal": "layer_0_layer_0_bin_maxbins_10_IMDB_Rating_extent" }, "maxbins": 10 }, { "type": "aggregate", "groupby": ["__bin_field_name", "__bin_field_name_end"], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "formula", "expr": "'[' + toString(datum[\"__bin_field_name\"]) + ', ' + toString(datum[\"__bin_field_name_end\"]) + ')'", "as": "__bin_range" }, { "type": "filter", "expr": "isValid(datum[\"__bin_field_name\"]) && isFinite(+datum[\"__bin_field_name\"]) && isValid(datum[\"__count\"]) && isFinite(+datum[\"__count\"])" } ] } ], "marks": [ { "name": "layer_0_layer_0_marks", "type": "rect", "clip": true, "style": ["bar"], "from": {"data": "movies"}, "encode": { "update": { "fill": {"value": "#4C78A8"}, "opacity": {"value": 1}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"IMDB_Rating (start): \" + (format(datum[\"__bin_field_name\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\")) + \"; __bin_field_name_end: \" + (format(datum[\"__bin_field_name_end\"], \"\"))" }, "x": {"scale": "x", "field": "__bin_field_name"}, "x2": {"scale": "x", "field": "__bin_field_name_end", "offset": -1}, "y": {"scale": "y", "field": "__count"}, "y2": {"scale": "y", "value": 0} } } } ], "scales": [ { "name": "x", "type": "linear", "domain": { "data": "movies", "fields": ["__bin_field_name", "__bin_field_name_end"] }, "range": [0, {"signal": "width"}], "nice": true, "zero": true }, { "name": "y", "type": "linear", "domain": {"fields": [{"data": "movies", "field": "__count"}, [0]]}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true } ], "axes": [ { "scale": "x", "orient": "bottom", "grid": true, "tickCount": 10, "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": "IMDB_Rating (start)", "labelFlush": false, "labels": true, "tickCount": 10, "ticks": true, "labelOverlap": true, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "Count of Records", "labelFlush": false, "labels": true, "ticks": true, "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }