diff --git a/examples/compiled/bar_1d_step_config.svg b/examples/compiled/bar_1d_step_config.svg new file mode 100644 index 0000000000..184e729aa9 --- /dev/null +++ b/examples/compiled/bar_1d_step_config.svg @@ -0,0 +1 @@ +050,000,000100,000,000150,000,000200,000,000250,000,000300,000,000population \ No newline at end of file diff --git a/examples/compiled/bar_1d_step_config.vg.json b/examples/compiled/bar_1d_step_config.vg.json new file mode 100644 index 0000000000..5d872f623d --- /dev/null +++ b/examples/compiled/bar_1d_step_config.vg.json @@ -0,0 +1,77 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "autosize": "pad", + "padding": 5, + "width": 200, + "height": 15, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/population.json", + "format": {"type": "json"}, + "transform": [ + {"type": "filter", "expr": "datum.year == 2000"}, + { + "type": "aggregate", + "groupby": [], + "ops": ["sum"], + "fields": ["people"], + "as": ["sum_people"] + } + ] + } + ], + "signals": [{"name": "height", "update": "height"}], + "marks": [ + { + "name": "marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "x": {"scale": "x", "field": "sum_people"}, + "x2": {"scale": "x", "value": 0}, + "yc": {"signal": "height", "mult": 0.5}, + "height": {"value": 13} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "linear", + "domain": {"data": "source_0", "field": "sum_people"}, + "range": [0, {"signal": "width"}], + "nice": true, + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "population", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 1 + }, + { + "scale": "x", + "orient": "bottom", + "grid": true, + "tickCount": {"signal": "ceil(width/40)"}, + "domain": false, + "labels": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + } + ] +} diff --git a/examples/compiled/bar_size_default.svg b/examples/compiled/bar_size_default.svg new file mode 100644 index 0000000000..d49bfa482e --- /dev/null +++ b/examples/compiled/bar_size_default.svg @@ -0,0 +1 @@ +EuropeJapanUSAOrigin050100150200250Count of Records \ No newline at end of file diff --git a/examples/compiled/bar_size_default.vg.json b/examples/compiled/bar_size_default.vg.json new file mode 100644 index 0000000000..42a1fa6e2c --- /dev/null +++ b/examples/compiled/bar_size_default.vg.json @@ -0,0 +1,99 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "autosize": "pad", + "padding": 5, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json"}, + "transform": [ + { + "type": "aggregate", + "groupby": ["Origin"], + "ops": ["count"], + "fields": [null], + "as": ["__count"] + } + ] + } + ], + "signals": [ + {"name": "x_step", "value": 20}, + { + "name": "width", + "update": "bandspace(domain('x').length, 0.1, 0.05) * x_step" + } + ], + "marks": [ + { + "name": "marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "x": {"scale": "x", "field": "Origin"}, + "width": {"scale": "x", "band": true}, + "y": {"scale": "y", "field": "__count"}, + "y2": {"scale": "y", "value": 0} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "band", + "domain": {"data": "source_0", "field": "Origin", "sort": true}, + "range": {"step": {"signal": "x_step"}}, + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "y", + "type": "linear", + "domain": {"data": "source_0", "field": "__count"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "Origin", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 1 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Count of Records", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 1 + }, + { + "scale": "y", + "orient": "left", + "gridScale": "x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + } + ] +} diff --git a/examples/compiled/bar_size_step_small.svg b/examples/compiled/bar_size_step_small.svg new file mode 100644 index 0000000000..b07d904e4d --- /dev/null +++ b/examples/compiled/bar_size_step_small.svg @@ -0,0 +1 @@ +EuropeJapanUSAOrigin050100150200250Count of Records \ No newline at end of file diff --git a/examples/compiled/bar_size_step_small.vg.json b/examples/compiled/bar_size_step_small.vg.json new file mode 100644 index 0000000000..b604332d16 --- /dev/null +++ b/examples/compiled/bar_size_step_small.vg.json @@ -0,0 +1,99 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "autosize": "pad", + "padding": 5, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json"}, + "transform": [ + { + "type": "aggregate", + "groupby": ["Origin"], + "ops": ["count"], + "fields": [null], + "as": ["__count"] + } + ] + } + ], + "signals": [ + {"name": "x_step", "value": 40}, + { + "name": "width", + "update": "bandspace(domain('x').length, 0.1, 0.05) * x_step" + } + ], + "marks": [ + { + "name": "marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "x": {"scale": "x", "field": "Origin"}, + "width": {"scale": "x", "band": true}, + "y": {"scale": "y", "field": "__count"}, + "y2": {"scale": "y", "value": 0} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "band", + "domain": {"data": "source_0", "field": "Origin", "sort": true}, + "range": {"step": {"signal": "x_step"}}, + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "y", + "type": "linear", + "domain": {"data": "source_0", "field": "__count"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "Origin", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 1 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Count of Records", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 1 + }, + { + "scale": "y", + "orient": "left", + "gridScale": "x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + } + ] +} diff --git a/examples/specs/normalized/bar_grouped_horizontal_normalized.vl.json b/examples/specs/normalized/bar_grouped_horizontal_normalized.vl.json index 73f6f463b3..5b046b325c 100644 --- a/examples/specs/normalized/bar_grouped_horizontal_normalized.vl.json +++ b/examples/specs/normalized/bar_grouped_horizontal_normalized.vl.json @@ -1,13 +1,16 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v3.json", "data": {"url": "data/population.json"}, - "transform": [{"filter": "datum.year == 2000"}, {"calculate": "datum.sex == 2 ? 'Female' : 'Male'", "as": "gender"}], + "transform": [ + {"filter": "datum.year == 2000"}, + {"calculate": "datum.sex == 2 ? 'Female' : 'Male'", "as": "gender"} + ], "spacing": 10, "config": {"view": {"stroke": "transparent"}, "axis": {"domainWidth": 1}}, "facet": {"row": {"field": "age", "type": "ordinal"}}, "spec": { - "height": {"step": 6}, "mark": "bar", + "height": {"step": 6}, "encoding": { "x": { "aggregate": "sum", @@ -15,11 +18,7 @@ "type": "quantitative", "axis": {"title": "population", "grid": false} }, - "y": { - "field": "gender", - "type": "nominal", - "axis": null - }, + "y": {"field": "gender", "type": "nominal", "axis": null}, "color": { "field": "gender", "type": "nominal", @@ -27,4 +26,4 @@ } } } -} +} \ No newline at end of file diff --git a/examples/specs/normalized/bar_grouped_normalized.vl.json b/examples/specs/normalized/bar_grouped_normalized.vl.json index c2784c77ca..9cde204404 100644 --- a/examples/specs/normalized/bar_grouped_normalized.vl.json +++ b/examples/specs/normalized/bar_grouped_normalized.vl.json @@ -1,13 +1,16 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v3.json", "data": {"url": "data/population.json"}, - "transform": [{"filter": "datum.year == 2000"}, {"calculate": "datum.sex == 2 ? 'Female' : 'Male'", "as": "gender"}], + "transform": [ + {"filter": "datum.year == 2000"}, + {"calculate": "datum.sex == 2 ? 'Female' : 'Male'", "as": "gender"} + ], "spacing": 10, "config": {"view": {"stroke": "transparent"}, "axis": {"domainWidth": 1}}, "facet": {"column": {"field": "age", "type": "ordinal"}}, "spec": { - "width": {"step": 12}, "mark": "bar", + "width": {"step": 12}, "encoding": { "y": { "aggregate": "sum", @@ -15,11 +18,7 @@ "type": "quantitative", "axis": {"title": "population", "grid": false} }, - "x": { - "field": "gender", - "type": "nominal", - "axis": {"title": ""} - }, + "x": {"field": "gender", "type": "nominal", "axis": {"title": ""}}, "color": { "field": "gender", "type": "nominal", @@ -27,4 +26,4 @@ } } } -} +} \ No newline at end of file diff --git a/examples/specs/normalized/facet_custom_header_normalized.vl.json b/examples/specs/normalized/facet_custom_header_normalized.vl.json index d424dbf13f..bb485302da 100644 --- a/examples/specs/normalized/facet_custom_header_normalized.vl.json +++ b/examples/specs/normalized/facet_custom_header_normalized.vl.json @@ -15,6 +15,7 @@ }, "spec": { "mark": "bar", + "width": {"step": 17}, "encoding": { "y": { "aggregate": "sum", @@ -22,7 +23,7 @@ "type": "quantitative", "axis": {"title": "population"} }, - "x": {"field": "age", "type": "ordinal", "scale": {"rangeStep": 17}}, + "x": {"field": "age", "type": "ordinal"}, "color": { "field": "gender", "type": "nominal", diff --git a/examples/specs/normalized/facet_custom_normalized.vl.json b/examples/specs/normalized/facet_custom_normalized.vl.json index 6f6d7d4914..bb485302da 100644 --- a/examples/specs/normalized/facet_custom_normalized.vl.json +++ b/examples/specs/normalized/facet_custom_normalized.vl.json @@ -2,7 +2,10 @@ "$schema": "https://vega.github.io/schema/vega-lite/v3.json", "description": "A trellis bar chart showing the US population distribution of age groups and gender in 2000.", "data": {"url": "data/population.json"}, - "transform": [{"filter": "datum.year == 2000"}, {"calculate": "datum.sex == 2 ? 'Female' : 'Male'", "as": "gender"}], + "transform": [ + {"filter": "datum.year == 2000"}, + {"calculate": "datum.sex == 2 ? 'Female' : 'Male'", "as": "gender"} + ], "facet": { "column": { "field": "gender", @@ -11,8 +14,8 @@ } }, "spec": { - "width": {"step": 17}, "mark": "bar", + "width": {"step": 17}, "encoding": { "y": { "aggregate": "sum", @@ -28,4 +31,4 @@ } } } -} +} \ No newline at end of file diff --git a/examples/specs/normalized/trellis_bar_normalized.vl.json b/examples/specs/normalized/trellis_bar_normalized.vl.json index 1fb34d2ef3..9736e9eee9 100644 --- a/examples/specs/normalized/trellis_bar_normalized.vl.json +++ b/examples/specs/normalized/trellis_bar_normalized.vl.json @@ -9,6 +9,7 @@ "facet": {"row": {"field": "gender", "type": "nominal"}}, "spec": { "mark": "bar", + "width": {"step": 17}, "encoding": { "y": { "aggregate": "sum", @@ -16,7 +17,7 @@ "type": "quantitative", "axis": {"title": "population"} }, - "x": {"field": "age", "type": "ordinal", "scale": {"rangeStep": 17}}, + "x": {"field": "age", "type": "ordinal"}, "color": { "field": "gender", "type": "nominal", diff --git a/examples/specs/normalized/trellis_barley_independent_normalized.vl.json b/examples/specs/normalized/trellis_barley_independent_normalized.vl.json index 4dfa1ae1af..172220e325 100644 --- a/examples/specs/normalized/trellis_barley_independent_normalized.vl.json +++ b/examples/specs/normalized/trellis_barley_independent_normalized.vl.json @@ -11,8 +11,8 @@ "sort": {"op": "median", "field": "yield"} }, "spec": { - "height": {"step": 12}, "mark": "point", + "height": {"step": 12}, "encoding": { "x": { "aggregate": "median", @@ -28,4 +28,4 @@ "color": {"field": "year", "type": "nominal"} } } -} +} \ No newline at end of file diff --git a/examples/specs/normalized/trellis_barley_layer_median_normalized.vl.json b/examples/specs/normalized/trellis_barley_layer_median_normalized.vl.json index 549f3b56d1..90fdecc142 100644 --- a/examples/specs/normalized/trellis_barley_layer_median_normalized.vl.json +++ b/examples/specs/normalized/trellis_barley_layer_median_normalized.vl.json @@ -43,4 +43,4 @@ } ] } -} +} \ No newline at end of file diff --git a/examples/specs/normalized/trellis_barley_normalized.vl.json b/examples/specs/normalized/trellis_barley_normalized.vl.json index 98c57d116e..21ff0f4478 100644 --- a/examples/specs/normalized/trellis_barley_normalized.vl.json +++ b/examples/specs/normalized/trellis_barley_normalized.vl.json @@ -10,8 +10,8 @@ "sort": {"op": "median", "field": "yield"} }, "spec": { - "height": {"step": 12}, "mark": "point", + "height": {"step": 12}, "encoding": { "x": { "aggregate": "median", @@ -27,4 +27,4 @@ "color": {"field": "year", "type": "nominal"} } } -} +} \ No newline at end of file