diff --git a/examples/compiled/point_bubble_relative.png b/examples/compiled/point_bubble_relative.png new file mode 100644 index 0000000000..0418169193 Binary files /dev/null and b/examples/compiled/point_bubble_relative.png differ diff --git a/examples/compiled/point_bubble_relative.svg b/examples/compiled/point_bubble_relative.svg new file mode 100644 index 0000000000..a2fbe06e8d --- /dev/null +++ b/examples/compiled/point_bubble_relative.svg @@ -0,0 +1 @@ +050100150200Horsepower01020304050Miles_per_Gallon05101520Acceleration \ No newline at end of file diff --git a/examples/compiled/point_bubble_relative.vg.json b/examples/compiled/point_bubble_relative.vg.json new file mode 100644 index 0000000000..4dede4ca8f --- /dev/null +++ b/examples/compiled/point_bubble_relative.vg.json @@ -0,0 +1,134 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "A bubbleplot showing horsepower on x, miles per gallons on y, and binned acceleration on size.", + "background": "white", + "padding": 5, + "width": 200, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json"}, + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"]) && isValid(datum[\"Miles_per_Gallon\"]) && isFinite(+datum[\"Miles_per_Gallon\"]) && isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Miles_per_Gallon: \" + (format(datum[\"Miles_per_Gallon\"], \"\")) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\"))" + }, + "x": {"scale": "x", "field": "Horsepower"}, + "y": {"scale": "y", "field": "Miles_per_Gallon"}, + "size": {"scale": "size", "field": "Acceleration"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "linear", + "domain": {"data": "source_0", "field": "Horsepower"}, + "range": [0, {"signal": "width"}], + "nice": true, + "zero": true + }, + { + "name": "y", + "type": "linear", + "domain": {"data": "source_0", "field": "Miles_per_Gallon"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "Acceleration"}, + "range": [4, {"signal": "PI * pow(0.2 * sqrt(width * height)/2, 2)"}], + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "gridScale": "y", + "grid": true, + "tickCount": {"signal": "ceil(width/40)"}, + "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": "Horsepower", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Miles_per_Gallon", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ], + "legends": [ + { + "size": "size", + "symbolType": "circle", + "title": "Acceleration", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "opacity": {"value": 0.7} + } + } + } + } + ] +} diff --git a/examples/compiled/point_relative_size_discrete.png b/examples/compiled/point_relative_size_discrete.png new file mode 100644 index 0000000000..9e731552f4 Binary files /dev/null and b/examples/compiled/point_relative_size_discrete.png differ diff --git a/examples/compiled/point_relative_size_discrete.svg b/examples/compiled/point_relative_size_discrete.svg new file mode 100644 index 0000000000..fb16d7e732 --- /dev/null +++ b/examples/compiled/point_relative_size_discrete.svg @@ -0,0 +1 @@ +020406080100120140160180200220240Horsepower34568Cylinders05101520Acceleration \ No newline at end of file diff --git a/examples/compiled/point_relative_size_discrete.vg.json b/examples/compiled/point_relative_size_discrete.vg.json new file mode 100644 index 0000000000..7759b13006 --- /dev/null +++ b/examples/compiled/point_relative_size_discrete.vg.json @@ -0,0 +1,121 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "width": 300, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json"}, + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"]) && isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Cylinders: \" + (isValid(datum[\"Cylinders\"]) ? datum[\"Cylinders\"] : \"\"+datum[\"Cylinders\"]) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\"))" + }, + "x": {"scale": "x", "field": "Horsepower"}, + "y": {"scale": "y", "field": "Cylinders"}, + "size": {"scale": "size", "field": "Acceleration"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "linear", + "domain": {"data": "source_0", "field": "Horsepower"}, + "range": [0, {"signal": "width"}], + "nice": true, + "zero": true + }, + { + "name": "y", + "type": "point", + "domain": {"data": "source_0", "field": "Cylinders", "sort": true}, + "range": [0, {"signal": "height"}], + "padding": 0.5 + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "Acceleration"}, + "range": [ + 4, + { + "signal": "PI * pow(0.4 * sqrt(width * height / length(domain(\"y\")))/2, 2)" + } + ], + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "gridScale": "y", + "grid": true, + "tickCount": {"signal": "ceil(width/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "Horsepower", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Cylinders", + "zindex": 0 + } + ], + "legends": [ + { + "size": "size", + "symbolType": "circle", + "title": "Acceleration", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "opacity": {"value": 0.7} + } + } + } + } + ] +} diff --git a/examples/compiled/point_relative_size_discrete_2.png b/examples/compiled/point_relative_size_discrete_2.png new file mode 100644 index 0000000000..565bd1c853 Binary files /dev/null and b/examples/compiled/point_relative_size_discrete_2.png differ diff --git a/examples/compiled/point_relative_size_discrete_2.svg b/examples/compiled/point_relative_size_discrete_2.svg new file mode 100644 index 0000000000..e68521f0b2 --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_2.svg @@ -0,0 +1 @@ +020406080100120Horsepower34Cylinders05101520Acceleration \ No newline at end of file diff --git a/examples/compiled/point_relative_size_discrete_2.vg.json b/examples/compiled/point_relative_size_discrete_2.vg.json new file mode 100644 index 0000000000..75c6a81f6b --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_2.vg.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "width": 300, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json", "parse": {"Cylinders": "number"}}, + "transform": [ + { + "type": "filter", + "expr": "indexof([3,4], datum[\"Cylinders\"]) !== -1" + }, + { + "type": "filter", + "expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"]) && isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Cylinders: \" + (isValid(datum[\"Cylinders\"]) ? datum[\"Cylinders\"] : \"\"+datum[\"Cylinders\"]) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\"))" + }, + "x": {"scale": "x", "field": "Horsepower"}, + "y": {"scale": "y", "field": "Cylinders"}, + "size": {"scale": "size", "field": "Acceleration"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "linear", + "domain": {"data": "source_0", "field": "Horsepower"}, + "range": [0, {"signal": "width"}], + "nice": true, + "zero": true + }, + { + "name": "y", + "type": "point", + "domain": {"data": "source_0", "field": "Cylinders", "sort": true}, + "range": [0, {"signal": "height"}], + "padding": 0.5 + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "Acceleration"}, + "range": [ + 4, + { + "signal": "PI * pow(0.4 * sqrt(width * height / length(domain(\"y\")))/2, 2)" + } + ], + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "gridScale": "y", + "grid": true, + "tickCount": {"signal": "ceil(width/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "Horsepower", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Cylinders", + "zindex": 0 + } + ], + "legends": [ + { + "size": "size", + "symbolType": "circle", + "title": "Acceleration", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "opacity": {"value": 0.7} + } + } + } + } + ] +} diff --git a/examples/compiled/point_relative_size_discrete_3.png b/examples/compiled/point_relative_size_discrete_3.png new file mode 100644 index 0000000000..1616fac2fe Binary files /dev/null and b/examples/compiled/point_relative_size_discrete_3.png differ diff --git a/examples/compiled/point_relative_size_discrete_3.svg b/examples/compiled/point_relative_size_discrete_3.svg new file mode 100644 index 0000000000..6a55c3ae3b --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_3.svg @@ -0,0 +1 @@ +020406080100120Horsepower345Cylinders05101520Acceleration \ No newline at end of file diff --git a/examples/compiled/point_relative_size_discrete_3.vg.json b/examples/compiled/point_relative_size_discrete_3.vg.json new file mode 100644 index 0000000000..a9af225a40 --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_3.vg.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "width": 300, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json", "parse": {"Cylinders": "number"}}, + "transform": [ + { + "type": "filter", + "expr": "indexof([3,4,5], datum[\"Cylinders\"]) !== -1" + }, + { + "type": "filter", + "expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"]) && isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Cylinders: \" + (isValid(datum[\"Cylinders\"]) ? datum[\"Cylinders\"] : \"\"+datum[\"Cylinders\"]) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\"))" + }, + "x": {"scale": "x", "field": "Horsepower"}, + "y": {"scale": "y", "field": "Cylinders"}, + "size": {"scale": "size", "field": "Acceleration"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "linear", + "domain": {"data": "source_0", "field": "Horsepower"}, + "range": [0, {"signal": "width"}], + "nice": true, + "zero": true + }, + { + "name": "y", + "type": "point", + "domain": {"data": "source_0", "field": "Cylinders", "sort": true}, + "range": [0, {"signal": "height"}], + "padding": 0.5 + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "Acceleration"}, + "range": [ + 4, + { + "signal": "PI * pow(0.4 * sqrt(width * height / length(domain(\"y\")))/2, 2)" + } + ], + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "gridScale": "y", + "grid": true, + "tickCount": {"signal": "ceil(width/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "Horsepower", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Cylinders", + "zindex": 0 + } + ], + "legends": [ + { + "size": "size", + "symbolType": "circle", + "title": "Acceleration", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "opacity": {"value": 0.7} + } + } + } + } + ] +} diff --git a/examples/compiled/point_relative_size_discrete_config.png b/examples/compiled/point_relative_size_discrete_config.png new file mode 100644 index 0000000000..9e731552f4 Binary files /dev/null and b/examples/compiled/point_relative_size_discrete_config.png differ diff --git a/examples/compiled/point_relative_size_discrete_config.svg b/examples/compiled/point_relative_size_discrete_config.svg new file mode 100644 index 0000000000..fb16d7e732 --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_config.svg @@ -0,0 +1 @@ +020406080100120140160180200220240Horsepower34568Cylinders05101520Acceleration \ No newline at end of file diff --git a/examples/compiled/point_relative_size_discrete_config.vg.json b/examples/compiled/point_relative_size_discrete_config.vg.json new file mode 100644 index 0000000000..7759b13006 --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_config.vg.json @@ -0,0 +1,121 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "width": 300, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json"}, + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"]) && isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Cylinders: \" + (isValid(datum[\"Cylinders\"]) ? datum[\"Cylinders\"] : \"\"+datum[\"Cylinders\"]) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\"))" + }, + "x": {"scale": "x", "field": "Horsepower"}, + "y": {"scale": "y", "field": "Cylinders"}, + "size": {"scale": "size", "field": "Acceleration"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "linear", + "domain": {"data": "source_0", "field": "Horsepower"}, + "range": [0, {"signal": "width"}], + "nice": true, + "zero": true + }, + { + "name": "y", + "type": "point", + "domain": {"data": "source_0", "field": "Cylinders", "sort": true}, + "range": [0, {"signal": "height"}], + "padding": 0.5 + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "Acceleration"}, + "range": [ + 4, + { + "signal": "PI * pow(0.4 * sqrt(width * height / length(domain(\"y\")))/2, 2)" + } + ], + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "gridScale": "y", + "grid": true, + "tickCount": {"signal": "ceil(width/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "Horsepower", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Cylinders", + "zindex": 0 + } + ], + "legends": [ + { + "size": "size", + "symbolType": "circle", + "title": "Acceleration", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "opacity": {"value": 0.7} + } + } + } + } + ] +} diff --git a/examples/compiled/point_relative_size_discrete_config_2.png b/examples/compiled/point_relative_size_discrete_config_2.png new file mode 100644 index 0000000000..565bd1c853 Binary files /dev/null and b/examples/compiled/point_relative_size_discrete_config_2.png differ diff --git a/examples/compiled/point_relative_size_discrete_config_2.svg b/examples/compiled/point_relative_size_discrete_config_2.svg new file mode 100644 index 0000000000..e68521f0b2 --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_config_2.svg @@ -0,0 +1 @@ +020406080100120Horsepower34Cylinders05101520Acceleration \ No newline at end of file diff --git a/examples/compiled/point_relative_size_discrete_config_2.vg.json b/examples/compiled/point_relative_size_discrete_config_2.vg.json new file mode 100644 index 0000000000..75c6a81f6b --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_config_2.vg.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "width": 300, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json", "parse": {"Cylinders": "number"}}, + "transform": [ + { + "type": "filter", + "expr": "indexof([3,4], datum[\"Cylinders\"]) !== -1" + }, + { + "type": "filter", + "expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"]) && isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Cylinders: \" + (isValid(datum[\"Cylinders\"]) ? datum[\"Cylinders\"] : \"\"+datum[\"Cylinders\"]) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\"))" + }, + "x": {"scale": "x", "field": "Horsepower"}, + "y": {"scale": "y", "field": "Cylinders"}, + "size": {"scale": "size", "field": "Acceleration"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "linear", + "domain": {"data": "source_0", "field": "Horsepower"}, + "range": [0, {"signal": "width"}], + "nice": true, + "zero": true + }, + { + "name": "y", + "type": "point", + "domain": {"data": "source_0", "field": "Cylinders", "sort": true}, + "range": [0, {"signal": "height"}], + "padding": 0.5 + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "Acceleration"}, + "range": [ + 4, + { + "signal": "PI * pow(0.4 * sqrt(width * height / length(domain(\"y\")))/2, 2)" + } + ], + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "gridScale": "y", + "grid": true, + "tickCount": {"signal": "ceil(width/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "Horsepower", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Cylinders", + "zindex": 0 + } + ], + "legends": [ + { + "size": "size", + "symbolType": "circle", + "title": "Acceleration", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "opacity": {"value": 0.7} + } + } + } + } + ] +} diff --git a/examples/compiled/point_relative_size_discrete_config_3.png b/examples/compiled/point_relative_size_discrete_config_3.png new file mode 100644 index 0000000000..1616fac2fe Binary files /dev/null and b/examples/compiled/point_relative_size_discrete_config_3.png differ diff --git a/examples/compiled/point_relative_size_discrete_config_3.svg b/examples/compiled/point_relative_size_discrete_config_3.svg new file mode 100644 index 0000000000..6a55c3ae3b --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_config_3.svg @@ -0,0 +1 @@ +020406080100120Horsepower345Cylinders05101520Acceleration \ No newline at end of file diff --git a/examples/compiled/point_relative_size_discrete_config_3.vg.json b/examples/compiled/point_relative_size_discrete_config_3.vg.json new file mode 100644 index 0000000000..a9af225a40 --- /dev/null +++ b/examples/compiled/point_relative_size_discrete_config_3.vg.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "width": 300, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "url": "data/cars.json", + "format": {"type": "json", "parse": {"Cylinders": "number"}}, + "transform": [ + { + "type": "filter", + "expr": "indexof([3,4,5], datum[\"Cylinders\"]) !== -1" + }, + { + "type": "filter", + "expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"]) && isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Cylinders: \" + (isValid(datum[\"Cylinders\"]) ? datum[\"Cylinders\"] : \"\"+datum[\"Cylinders\"]) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\"))" + }, + "x": {"scale": "x", "field": "Horsepower"}, + "y": {"scale": "y", "field": "Cylinders"}, + "size": {"scale": "size", "field": "Acceleration"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "linear", + "domain": {"data": "source_0", "field": "Horsepower"}, + "range": [0, {"signal": "width"}], + "nice": true, + "zero": true + }, + { + "name": "y", + "type": "point", + "domain": {"data": "source_0", "field": "Cylinders", "sort": true}, + "range": [0, {"signal": "height"}], + "padding": 0.5 + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "Acceleration"}, + "range": [ + 4, + { + "signal": "PI * pow(0.4 * sqrt(width * height / length(domain(\"y\")))/2, 2)" + } + ], + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "gridScale": "y", + "grid": true, + "tickCount": {"signal": "ceil(width/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "x", + "orient": "bottom", + "grid": false, + "title": "Horsepower", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "Cylinders", + "zindex": 0 + } + ], + "legends": [ + { + "size": "size", + "symbolType": "circle", + "title": "Acceleration", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "opacity": {"value": 0.7} + } + } + } + } + ] +}