Module

x/vega_lite/examples/compiled/repeat_independent_colors.vg.json

A concise grammar of interactive graphics, built on Vega.
Latest
File
{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "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\"])" } ] } ], "signals": [ {"name": "childWidth", "value": 200}, {"name": "childHeight", "value": 200} ], "layout": {"padding": 20, "columns": 2, "bounds": "full", "align": "all"}, "marks": [ { "type": "group", "name": "child__column_Origin_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__column_Origin_marks", "type": "symbol", "style": ["point"], "from": {"data": "source_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": { "scale": "child__column_Origin_color", "field": "Origin" }, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Miles_per_Gallon: \" + (format(datum[\"Miles_per_Gallon\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": {"scale": "child__column_Origin_x", "field": "Horsepower"}, "y": { "scale": "child__column_Origin_y", "field": "Miles_per_Gallon" } } } } ], "axes": [ { "scale": "child__column_Origin_x", "orient": "bottom", "gridScale": "child__column_Origin_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_Origin_y", "orient": "left", "gridScale": "child__column_Origin_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_Origin_x", "orient": "bottom", "grid": false, "title": "Horsepower", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__column_Origin_y", "orient": "left", "grid": false, "title": "Miles_per_Gallon", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ], "legends": [ { "stroke": "child__column_Origin_color", "symbolType": "circle", "title": "Origin", "encode": { "symbols": { "update": { "fill": {"value": "transparent"}, "opacity": {"value": 0.7} } } } } ] }, { "type": "group", "name": "child__column_Cylinders_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__column_Cylinders_marks", "type": "symbol", "style": ["point"], "from": {"data": "source_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": { "scale": "child__column_Cylinders_color", "field": "Cylinders" }, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Miles_per_Gallon: \" + (format(datum[\"Miles_per_Gallon\"], \"\")) + \"; Cylinders: \" + (isValid(datum[\"Cylinders\"]) ? datum[\"Cylinders\"] : \"\"+datum[\"Cylinders\"])" }, "x": { "scale": "child__column_Cylinders_x", "field": "Horsepower" }, "y": { "scale": "child__column_Cylinders_y", "field": "Miles_per_Gallon" } } } } ], "axes": [ { "scale": "child__column_Cylinders_x", "orient": "bottom", "gridScale": "child__column_Cylinders_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_Cylinders_y", "orient": "left", "gridScale": "child__column_Cylinders_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_Cylinders_x", "orient": "bottom", "grid": false, "title": "Horsepower", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__column_Cylinders_y", "orient": "left", "grid": false, "title": "Miles_per_Gallon", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ], "legends": [ { "stroke": "child__column_Cylinders_color", "symbolType": "circle", "title": "Cylinders", "encode": { "symbols": { "update": { "fill": {"value": "transparent"}, "opacity": {"value": 0.7} } } } } ] } ], "scales": [ { "name": "child__column_Origin_x", "type": "linear", "domain": {"data": "source_0", "field": "Horsepower"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__column_Origin_y", "type": "linear", "domain": {"data": "source_0", "field": "Miles_per_Gallon"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__column_Origin_color", "type": "ordinal", "domain": {"data": "source_0", "field": "Origin", "sort": true}, "range": "category" }, { "name": "child__column_Cylinders_x", "type": "linear", "domain": {"data": "source_0", "field": "Horsepower"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__column_Cylinders_y", "type": "linear", "domain": {"data": "source_0", "field": "Miles_per_Gallon"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__column_Cylinders_color", "type": "ordinal", "domain": {"data": "source_0", "field": "Cylinders", "sort": true}, "range": "category" } ]}