{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Source: https://vega.github.io/vega-lite/examples/histogram_log.html", "background": "white", "padding": 5, "width": 200, "height": 200, "style": "cell", "data": [ { "name": "source_0", "values": [ {"x": 0.01}, {"x": 0.1}, {"x": 1}, {"x": 1}, {"x": 1}, {"x": 1}, {"x": 10}, {"x": 10}, {"x": 100}, {"x": 500}, {"x": 800} ] }, { "name": "data_0", "source": "source_0", "transform": [ {"type": "formula", "expr": "log(datum.x)/log(10)", "as": "log_x"}, { "type": "extent", "field": "log_x", "signal": "bin_maxbins_10_log_x_extent" }, { "type": "bin", "field": "log_x", "as": ["bin_log_x", "bin_log_x_end"], "signal": "bin_maxbins_10_log_x_bins", "extent": {"signal": "bin_maxbins_10_log_x_extent"}, "maxbins": 10 }, {"type": "formula", "expr": "pow(10, datum.bin_log_x)", "as": "x1"}, {"type": "formula", "expr": "pow(10, datum.bin_log_x_end)", "as": "x2"}, { "type": "aggregate", "groupby": ["x1", "x2"], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"x1\"]) && isFinite(+datum[\"x1\"])" } ] } ], "marks": [ { "name": "marks", "type": "rect", "style": ["bar"], "from": {"data": "data_0"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"x1: \" + (format(datum[\"x1\"], \"\")) + \"; x2: \" + (format(datum[\"x2\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" }, "x": {"scale": "x", "field": "x1"}, "x2": {"scale": "x", "field": "x2"}, "y": {"scale": "y", "field": "__count"}, "y2": {"scale": "y", "value": 0} } } } ], "scales": [ { "name": "x", "type": "log", "domain": {"data": "data_0", "fields": ["x1", "x2"]}, "range": [0, {"signal": "width"}], "base": 10, "nice": true, "padding": 5 }, { "name": "y", "type": "linear", "domain": {"data": "data_0", "field": "__count"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true } ], "axes": [ { "scale": "x", "orient": "bottom", "tickCount": 5, "gridScale": "y", "grid": true, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "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": "x1, x2", "tickCount": 5, "labelFlush": true, "labelOverlap": "greedy", "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "Count of Records", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }