{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "data": [ {"name": "brush_store"}, {"name": "source_0", "url": "data/cars.json", "format": {"type": "json"}}, { "name": "data_0", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Miles_per_Gallon\"]) && isFinite(+datum[\"Miles_per_Gallon\"]) && isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"])" } ] }, { "name": "data_1", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"]) && isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"])" } ] }, { "name": "data_2", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"])" } ] }, { "name": "data_3", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Miles_per_Gallon\"]) && isFinite(+datum[\"Miles_per_Gallon\"]) && isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" } ] }, { "name": "data_4", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Acceleration\"]) && isFinite(+datum[\"Acceleration\"])" } ] }, { "name": "data_5", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Miles_per_Gallon\"]) && isFinite(+datum[\"Miles_per_Gallon\"])" } ] } ], "signals": [ {"name": "childWidth", "value": 200}, {"name": "childHeight", "value": 200}, { "name": "unit", "value": {}, "on": [ {"events": "mousemove", "update": "isTuple(group()) ? group() : unit"} ] }, { "name": "brush", "update": "vlSelectionResolve(\"brush_store\", \"intersect\")" } ], "layout": {"padding": 20, "columns": 3, "bounds": "full", "align": "all"}, "marks": [ { "type": "group", "name": "child__row_Horsepowercolumn_Miles_per_Gallon_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Horsepowercolumn_Miles_per_Gallon_x\", brush_Miles_per_Gallon[0]), scale(\"child__row_Horsepowercolumn_Miles_per_Gallon_x\", brush_Miles_per_Gallon[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Miles_per_Gallon", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Horsepowercolumn_Miles_per_Gallon_x\", brush_x)" } ] }, { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, childHeight)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Horsepowercolumn_Miles_per_Gallon_y\", brush_Horsepower[0]), scale(\"child__row_Horsepowercolumn_Miles_per_Gallon_y\", brush_Horsepower[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, childHeight)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, childHeight)" } ] }, { "name": "brush_Horsepower", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"child__row_Horsepowercolumn_Miles_per_Gallon_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [ {"scale": "child__row_Horsepowercolumn_Miles_per_Gallon_x"}, {"scale": "child__row_Horsepowercolumn_Miles_per_Gallon_y"} ], "update": "(!isArray(brush_Miles_per_Gallon) || (+invert(\"child__row_Horsepowercolumn_Miles_per_Gallon_x\", brush_x)[0] === +brush_Miles_per_Gallon[0] && +invert(\"child__row_Horsepowercolumn_Miles_per_Gallon_x\", brush_x)[1] === +brush_Miles_per_Gallon[1])) && (!isArray(brush_Horsepower) || (+invert(\"child__row_Horsepowercolumn_Miles_per_Gallon_y\", brush_y)[0] === +brush_Horsepower[0] && +invert(\"child__row_Horsepowercolumn_Miles_per_Gallon_y\", brush_y)[1] === +brush_Horsepower[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [ {"signal": "brush_Miles_per_Gallon || brush_Horsepower"} ], "update": "brush_Miles_per_Gallon && brush_Horsepower ? {unit: \"child__row_Horsepowercolumn_Miles_per_Gallon\", fields: brush_tuple_fields, values: [brush_Miles_per_Gallon,brush_Horsepower]} : null" } ] }, { "name": "brush_tuple_fields", "value": [ {"field": "Miles_per_Gallon", "channel": "x", "type": "R"}, {"field": "Horsepower", "channel": "y", "type": "R"} ] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Horsepowercolumn_Miles_per_Gallon\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"} } } }, { "name": "child__row_Horsepowercolumn_Miles_per_Gallon_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Miles_per_Gallon: \" + (format(datum[\"Miles_per_Gallon\"], \"\")) + \"; Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": { "scale": "child__row_Horsepowercolumn_Miles_per_Gallon_x", "field": "Miles_per_Gallon" }, "y": { "scale": "child__row_Horsepowercolumn_Miles_per_Gallon_y", "field": "Horsepower" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"}, "stroke": [ { "test": "brush_x[0] !== brush_x[1] && brush_y[0] !== brush_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Horsepowercolumn_Miles_per_Gallon_x", "orient": "bottom", "gridScale": "child__row_Horsepowercolumn_Miles_per_Gallon_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Miles_per_Gallon_y", "orient": "left", "gridScale": "child__row_Horsepowercolumn_Miles_per_Gallon_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Miles_per_Gallon_x", "orient": "bottom", "grid": false, "title": "Miles_per_Gallon", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Miles_per_Gallon_y", "orient": "left", "grid": false, "title": "Horsepower", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__row_Horsepowercolumn_Acceleration_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Horsepowercolumn_Acceleration_x\", brush_Acceleration[0]), scale(\"child__row_Horsepowercolumn_Acceleration_x\", brush_Acceleration[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Acceleration", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Horsepowercolumn_Acceleration_x\", brush_x)" } ] }, { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, childHeight)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Horsepowercolumn_Acceleration_y\", brush_Horsepower[0]), scale(\"child__row_Horsepowercolumn_Acceleration_y\", brush_Horsepower[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, childHeight)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, childHeight)" } ] }, { "name": "brush_Horsepower", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"child__row_Horsepowercolumn_Acceleration_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [ {"scale": "child__row_Horsepowercolumn_Acceleration_x"}, {"scale": "child__row_Horsepowercolumn_Acceleration_y"} ], "update": "(!isArray(brush_Acceleration) || (+invert(\"child__row_Horsepowercolumn_Acceleration_x\", brush_x)[0] === +brush_Acceleration[0] && +invert(\"child__row_Horsepowercolumn_Acceleration_x\", brush_x)[1] === +brush_Acceleration[1])) && (!isArray(brush_Horsepower) || (+invert(\"child__row_Horsepowercolumn_Acceleration_y\", brush_y)[0] === +brush_Horsepower[0] && +invert(\"child__row_Horsepowercolumn_Acceleration_y\", brush_y)[1] === +brush_Horsepower[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [{"signal": "brush_Acceleration || brush_Horsepower"}], "update": "brush_Acceleration && brush_Horsepower ? {unit: \"child__row_Horsepowercolumn_Acceleration\", fields: brush_tuple_fields, values: [brush_Acceleration,brush_Horsepower]} : null" } ] }, { "name": "brush_tuple_fields", "value": [ {"field": "Acceleration", "channel": "x", "type": "R"}, {"field": "Horsepower", "channel": "y", "type": "R"} ] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Horsepowercolumn_Acceleration\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"} } } }, { "name": "child__row_Horsepowercolumn_Acceleration_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_1"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Acceleration: \" + (format(datum[\"Acceleration\"], \"\")) + \"; Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": { "scale": "child__row_Horsepowercolumn_Acceleration_x", "field": "Acceleration" }, "y": { "scale": "child__row_Horsepowercolumn_Acceleration_y", "field": "Horsepower" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"}, "stroke": [ { "test": "brush_x[0] !== brush_x[1] && brush_y[0] !== brush_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Horsepowercolumn_Acceleration_x", "orient": "bottom", "gridScale": "child__row_Horsepowercolumn_Acceleration_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Acceleration_y", "orient": "left", "gridScale": "child__row_Horsepowercolumn_Acceleration_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Acceleration_x", "orient": "bottom", "grid": false, "title": "Acceleration", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Acceleration_y", "orient": "left", "grid": false, "title": "Horsepower", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__row_Horsepowercolumn_Horsepower_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Horsepowercolumn_Horsepower_x\", brush_Horsepower[0]), scale(\"child__row_Horsepowercolumn_Horsepower_x\", brush_Horsepower[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Horsepower", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Horsepowercolumn_Horsepower_x\", brush_x)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [{"scale": "child__row_Horsepowercolumn_Horsepower_x"}], "update": "(!isArray(brush_Horsepower) || (+invert(\"child__row_Horsepowercolumn_Horsepower_x\", brush_x)[0] === +brush_Horsepower[0] && +invert(\"child__row_Horsepowercolumn_Horsepower_x\", brush_x)[1] === +brush_Horsepower[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [{"signal": "brush_Horsepower"}], "update": "brush_Horsepower ? {unit: \"child__row_Horsepowercolumn_Horsepower\", fields: brush_tuple_fields, values: [brush_Horsepower]} : null" } ] }, { "name": "brush_tuple_fields", "value": [{"field": "Horsepower", "channel": "x", "type": "R"}] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Horsepowercolumn_Horsepower\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"value": 0}, "x2": {"signal": "brush_x[1]"}, "y2": {"field": {"group": "height"}} } } }, { "name": "child__row_Horsepowercolumn_Horsepower_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_2"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": { "scale": "child__row_Horsepowercolumn_Horsepower_x", "field": "Horsepower" }, "y": { "scale": "child__row_Horsepowercolumn_Horsepower_y", "field": "Horsepower" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"value": 0}, "x2": {"signal": "brush_x[1]"}, "y2": {"field": {"group": "height"}}, "stroke": [ {"test": "brush_x[0] !== brush_x[1]", "value": "white"}, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Horsepowercolumn_Horsepower_x", "orient": "bottom", "gridScale": "child__row_Horsepowercolumn_Horsepower_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Horsepower_y", "orient": "left", "gridScale": "child__row_Horsepowercolumn_Horsepower_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Horsepower_x", "orient": "bottom", "grid": false, "title": "Horsepower", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Horsepowercolumn_Horsepower_y", "orient": "left", "grid": false, "title": "Horsepower", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__row_Accelerationcolumn_Miles_per_Gallon_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Accelerationcolumn_Miles_per_Gallon_x\", brush_Miles_per_Gallon[0]), scale(\"child__row_Accelerationcolumn_Miles_per_Gallon_x\", brush_Miles_per_Gallon[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Miles_per_Gallon", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Accelerationcolumn_Miles_per_Gallon_x\", brush_x)" } ] }, { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, childHeight)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Accelerationcolumn_Miles_per_Gallon_y\", brush_Acceleration[0]), scale(\"child__row_Accelerationcolumn_Miles_per_Gallon_y\", brush_Acceleration[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, childHeight)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, childHeight)" } ] }, { "name": "brush_Acceleration", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"child__row_Accelerationcolumn_Miles_per_Gallon_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [ {"scale": "child__row_Accelerationcolumn_Miles_per_Gallon_x"}, {"scale": "child__row_Accelerationcolumn_Miles_per_Gallon_y"} ], "update": "(!isArray(brush_Miles_per_Gallon) || (+invert(\"child__row_Accelerationcolumn_Miles_per_Gallon_x\", brush_x)[0] === +brush_Miles_per_Gallon[0] && +invert(\"child__row_Accelerationcolumn_Miles_per_Gallon_x\", brush_x)[1] === +brush_Miles_per_Gallon[1])) && (!isArray(brush_Acceleration) || (+invert(\"child__row_Accelerationcolumn_Miles_per_Gallon_y\", brush_y)[0] === +brush_Acceleration[0] && +invert(\"child__row_Accelerationcolumn_Miles_per_Gallon_y\", brush_y)[1] === +brush_Acceleration[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [ {"signal": "brush_Miles_per_Gallon || brush_Acceleration"} ], "update": "brush_Miles_per_Gallon && brush_Acceleration ? {unit: \"child__row_Accelerationcolumn_Miles_per_Gallon\", fields: brush_tuple_fields, values: [brush_Miles_per_Gallon,brush_Acceleration]} : null" } ] }, { "name": "brush_tuple_fields", "value": [ {"field": "Miles_per_Gallon", "channel": "x", "type": "R"}, {"field": "Acceleration", "channel": "y", "type": "R"} ] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Accelerationcolumn_Miles_per_Gallon\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"} } } }, { "name": "child__row_Accelerationcolumn_Miles_per_Gallon_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_3"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Miles_per_Gallon: \" + (format(datum[\"Miles_per_Gallon\"], \"\")) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": { "scale": "child__row_Accelerationcolumn_Miles_per_Gallon_x", "field": "Miles_per_Gallon" }, "y": { "scale": "child__row_Accelerationcolumn_Miles_per_Gallon_y", "field": "Acceleration" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"}, "stroke": [ { "test": "brush_x[0] !== brush_x[1] && brush_y[0] !== brush_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Accelerationcolumn_Miles_per_Gallon_x", "orient": "bottom", "gridScale": "child__row_Accelerationcolumn_Miles_per_Gallon_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Miles_per_Gallon_y", "orient": "left", "gridScale": "child__row_Accelerationcolumn_Miles_per_Gallon_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Miles_per_Gallon_x", "orient": "bottom", "grid": false, "title": "Miles_per_Gallon", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Miles_per_Gallon_y", "orient": "left", "grid": false, "title": "Acceleration", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__row_Accelerationcolumn_Acceleration_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Accelerationcolumn_Acceleration_x\", brush_Acceleration[0]), scale(\"child__row_Accelerationcolumn_Acceleration_x\", brush_Acceleration[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Acceleration", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Accelerationcolumn_Acceleration_x\", brush_x)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [ {"scale": "child__row_Accelerationcolumn_Acceleration_x"} ], "update": "(!isArray(brush_Acceleration) || (+invert(\"child__row_Accelerationcolumn_Acceleration_x\", brush_x)[0] === +brush_Acceleration[0] && +invert(\"child__row_Accelerationcolumn_Acceleration_x\", brush_x)[1] === +brush_Acceleration[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [{"signal": "brush_Acceleration"}], "update": "brush_Acceleration ? {unit: \"child__row_Accelerationcolumn_Acceleration\", fields: brush_tuple_fields, values: [brush_Acceleration]} : null" } ] }, { "name": "brush_tuple_fields", "value": [{"field": "Acceleration", "channel": "x", "type": "R"}] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Accelerationcolumn_Acceleration\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"value": 0}, "x2": {"signal": "brush_x[1]"}, "y2": {"field": {"group": "height"}} } } }, { "name": "child__row_Accelerationcolumn_Acceleration_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_4"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Acceleration: \" + (format(datum[\"Acceleration\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": { "scale": "child__row_Accelerationcolumn_Acceleration_x", "field": "Acceleration" }, "y": { "scale": "child__row_Accelerationcolumn_Acceleration_y", "field": "Acceleration" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"value": 0}, "x2": {"signal": "brush_x[1]"}, "y2": {"field": {"group": "height"}}, "stroke": [ {"test": "brush_x[0] !== brush_x[1]", "value": "white"}, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Accelerationcolumn_Acceleration_x", "orient": "bottom", "gridScale": "child__row_Accelerationcolumn_Acceleration_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Acceleration_y", "orient": "left", "gridScale": "child__row_Accelerationcolumn_Acceleration_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Acceleration_x", "orient": "bottom", "grid": false, "title": "Acceleration", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Acceleration_y", "orient": "left", "grid": false, "title": "Acceleration", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__row_Accelerationcolumn_Horsepower_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Accelerationcolumn_Horsepower_x\", brush_Horsepower[0]), scale(\"child__row_Accelerationcolumn_Horsepower_x\", brush_Horsepower[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Horsepower", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Accelerationcolumn_Horsepower_x\", brush_x)" } ] }, { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, childHeight)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Accelerationcolumn_Horsepower_y\", brush_Acceleration[0]), scale(\"child__row_Accelerationcolumn_Horsepower_y\", brush_Acceleration[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, childHeight)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, childHeight)" } ] }, { "name": "brush_Acceleration", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"child__row_Accelerationcolumn_Horsepower_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [ {"scale": "child__row_Accelerationcolumn_Horsepower_x"}, {"scale": "child__row_Accelerationcolumn_Horsepower_y"} ], "update": "(!isArray(brush_Horsepower) || (+invert(\"child__row_Accelerationcolumn_Horsepower_x\", brush_x)[0] === +brush_Horsepower[0] && +invert(\"child__row_Accelerationcolumn_Horsepower_x\", brush_x)[1] === +brush_Horsepower[1])) && (!isArray(brush_Acceleration) || (+invert(\"child__row_Accelerationcolumn_Horsepower_y\", brush_y)[0] === +brush_Acceleration[0] && +invert(\"child__row_Accelerationcolumn_Horsepower_y\", brush_y)[1] === +brush_Acceleration[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [{"signal": "brush_Horsepower || brush_Acceleration"}], "update": "brush_Horsepower && brush_Acceleration ? {unit: \"child__row_Accelerationcolumn_Horsepower\", fields: brush_tuple_fields, values: [brush_Horsepower,brush_Acceleration]} : null" } ] }, { "name": "brush_tuple_fields", "value": [ {"field": "Horsepower", "channel": "x", "type": "R"}, {"field": "Acceleration", "channel": "y", "type": "R"} ] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Accelerationcolumn_Horsepower\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"} } } }, { "name": "child__row_Accelerationcolumn_Horsepower_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_1"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Acceleration: \" + (format(datum[\"Acceleration\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": { "scale": "child__row_Accelerationcolumn_Horsepower_x", "field": "Horsepower" }, "y": { "scale": "child__row_Accelerationcolumn_Horsepower_y", "field": "Acceleration" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"}, "stroke": [ { "test": "brush_x[0] !== brush_x[1] && brush_y[0] !== brush_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Accelerationcolumn_Horsepower_x", "orient": "bottom", "gridScale": "child__row_Accelerationcolumn_Horsepower_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Horsepower_y", "orient": "left", "gridScale": "child__row_Accelerationcolumn_Horsepower_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Horsepower_x", "orient": "bottom", "grid": false, "title": "Horsepower", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Accelerationcolumn_Horsepower_y", "orient": "left", "grid": false, "title": "Acceleration", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x\", brush_Miles_per_Gallon[0]), scale(\"child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x\", brush_Miles_per_Gallon[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Miles_per_Gallon", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x\", brush_x)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [ { "scale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x" } ], "update": "(!isArray(brush_Miles_per_Gallon) || (+invert(\"child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x\", brush_x)[0] === +brush_Miles_per_Gallon[0] && +invert(\"child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x\", brush_x)[1] === +brush_Miles_per_Gallon[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [{"signal": "brush_Miles_per_Gallon"}], "update": "brush_Miles_per_Gallon ? {unit: \"child__row_Miles_per_Galloncolumn_Miles_per_Gallon\", fields: brush_tuple_fields, values: [brush_Miles_per_Gallon]} : null" } ] }, { "name": "brush_tuple_fields", "value": [{"field": "Miles_per_Gallon", "channel": "x", "type": "R"}] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Miles_per_Galloncolumn_Miles_per_Gallon\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"value": 0}, "x2": {"signal": "brush_x[1]"}, "y2": {"field": {"group": "height"}} } } }, { "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_5"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Miles_per_Gallon: \" + (format(datum[\"Miles_per_Gallon\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": { "scale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x", "field": "Miles_per_Gallon" }, "y": { "scale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_y", "field": "Miles_per_Gallon" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"value": 0}, "x2": {"signal": "brush_x[1]"}, "y2": {"field": {"group": "height"}}, "stroke": [ {"test": "brush_x[0] !== brush_x[1]", "value": "white"}, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x", "orient": "bottom", "gridScale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_y", "orient": "left", "gridScale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x", "orient": "bottom", "grid": false, "title": "Miles_per_Gallon", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_y", "orient": "left", "grid": false, "title": "Miles_per_Gallon", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__row_Miles_per_Galloncolumn_Acceleration_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Miles_per_Galloncolumn_Acceleration_x\", brush_Acceleration[0]), scale(\"child__row_Miles_per_Galloncolumn_Acceleration_x\", brush_Acceleration[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Acceleration", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Miles_per_Galloncolumn_Acceleration_x\", brush_x)" } ] }, { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, childHeight)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Miles_per_Galloncolumn_Acceleration_y\", brush_Miles_per_Gallon[0]), scale(\"child__row_Miles_per_Galloncolumn_Acceleration_y\", brush_Miles_per_Gallon[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, childHeight)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, childHeight)" } ] }, { "name": "brush_Miles_per_Gallon", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"child__row_Miles_per_Galloncolumn_Acceleration_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [ {"scale": "child__row_Miles_per_Galloncolumn_Acceleration_x"}, {"scale": "child__row_Miles_per_Galloncolumn_Acceleration_y"} ], "update": "(!isArray(brush_Acceleration) || (+invert(\"child__row_Miles_per_Galloncolumn_Acceleration_x\", brush_x)[0] === +brush_Acceleration[0] && +invert(\"child__row_Miles_per_Galloncolumn_Acceleration_x\", brush_x)[1] === +brush_Acceleration[1])) && (!isArray(brush_Miles_per_Gallon) || (+invert(\"child__row_Miles_per_Galloncolumn_Acceleration_y\", brush_y)[0] === +brush_Miles_per_Gallon[0] && +invert(\"child__row_Miles_per_Galloncolumn_Acceleration_y\", brush_y)[1] === +brush_Miles_per_Gallon[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [ {"signal": "brush_Acceleration || brush_Miles_per_Gallon"} ], "update": "brush_Acceleration && brush_Miles_per_Gallon ? {unit: \"child__row_Miles_per_Galloncolumn_Acceleration\", fields: brush_tuple_fields, values: [brush_Acceleration,brush_Miles_per_Gallon]} : null" } ] }, { "name": "brush_tuple_fields", "value": [ {"field": "Acceleration", "channel": "x", "type": "R"}, {"field": "Miles_per_Gallon", "channel": "y", "type": "R"} ] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Miles_per_Galloncolumn_Acceleration\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"} } } }, { "name": "child__row_Miles_per_Galloncolumn_Acceleration_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_3"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Acceleration: \" + (format(datum[\"Acceleration\"], \"\")) + \"; Miles_per_Gallon: \" + (format(datum[\"Miles_per_Gallon\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x": { "scale": "child__row_Miles_per_Galloncolumn_Acceleration_x", "field": "Acceleration" }, "y": { "scale": "child__row_Miles_per_Galloncolumn_Acceleration_y", "field": "Miles_per_Gallon" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"}, "stroke": [ { "test": "brush_x[0] !== brush_x[1] && brush_y[0] !== brush_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Miles_per_Galloncolumn_Acceleration_x", "orient": "bottom", "gridScale": "child__row_Miles_per_Galloncolumn_Acceleration_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Acceleration_y", "orient": "left", "gridScale": "child__row_Miles_per_Galloncolumn_Acceleration_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Acceleration_x", "orient": "bottom", "grid": false, "title": "Acceleration", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Acceleration_y", "orient": "left", "grid": false, "title": "Miles_per_Gallon", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__row_Miles_per_Galloncolumn_Horsepower_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, childWidth)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Miles_per_Galloncolumn_Horsepower_x\", brush_Horsepower[0]), scale(\"child__row_Miles_per_Galloncolumn_Horsepower_x\", brush_Horsepower[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, childWidth)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, childWidth)" } ] }, { "name": "brush_Horsepower", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"child__row_Miles_per_Galloncolumn_Horsepower_x\", brush_x)" } ] }, { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, childHeight)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"child__row_Miles_per_Galloncolumn_Horsepower_y\", brush_Miles_per_Gallon[0]), scale(\"child__row_Miles_per_Galloncolumn_Horsepower_y\", brush_Miles_per_Gallon[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, childHeight)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, childHeight)" } ] }, { "name": "brush_Miles_per_Gallon", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"child__row_Miles_per_Galloncolumn_Horsepower_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [ {"scale": "child__row_Miles_per_Galloncolumn_Horsepower_x"}, {"scale": "child__row_Miles_per_Galloncolumn_Horsepower_y"} ], "update": "(!isArray(brush_Horsepower) || (+invert(\"child__row_Miles_per_Galloncolumn_Horsepower_x\", brush_x)[0] === +brush_Horsepower[0] && +invert(\"child__row_Miles_per_Galloncolumn_Horsepower_x\", brush_x)[1] === +brush_Horsepower[1])) && (!isArray(brush_Miles_per_Gallon) || (+invert(\"child__row_Miles_per_Galloncolumn_Horsepower_y\", brush_y)[0] === +brush_Miles_per_Gallon[0] && +invert(\"child__row_Miles_per_Galloncolumn_Horsepower_y\", brush_y)[1] === +brush_Miles_per_Gallon[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [ {"signal": "brush_Horsepower || brush_Miles_per_Gallon"} ], "update": "brush_Horsepower && brush_Miles_per_Gallon ? {unit: \"child__row_Miles_per_Galloncolumn_Horsepower\", fields: brush_tuple_fields, values: [brush_Horsepower,brush_Miles_per_Gallon]} : null" } ] }, { "name": "brush_tuple_fields", "value": [ {"field": "Horsepower", "channel": "x", "type": "R"}, {"field": "Miles_per_Gallon", "channel": "y", "type": "R"} ] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, {unit: \"child__row_Miles_per_Galloncolumn_Horsepower\"})" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"} } } }, { "name": "child__row_Miles_per_Galloncolumn_Horsepower_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum, \"intersect\")", "scale": "color", "field": "Origin" }, {"value": "grey"} ], "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__row_Miles_per_Galloncolumn_Horsepower_x", "field": "Horsepower" }, "y": { "scale": "child__row_Miles_per_Galloncolumn_Horsepower_y", "field": "Miles_per_Gallon" } } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": {"signal": "brush_x[0]"}, "y": {"signal": "brush_y[0]"}, "x2": {"signal": "brush_x[1]"}, "y2": {"signal": "brush_y[1]"}, "stroke": [ { "test": "brush_x[0] !== brush_x[1] && brush_y[0] !== brush_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "child__row_Miles_per_Galloncolumn_Horsepower_x", "orient": "bottom", "gridScale": "child__row_Miles_per_Galloncolumn_Horsepower_y", "grid": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Horsepower_y", "orient": "left", "gridScale": "child__row_Miles_per_Galloncolumn_Horsepower_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Horsepower_x", "orient": "bottom", "grid": false, "title": "Horsepower", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/40)"}, "zindex": 0 }, { "scale": "child__row_Miles_per_Galloncolumn_Horsepower_y", "orient": "left", "grid": false, "title": "Miles_per_Gallon", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] } ], "scales": [ { "name": "color", "type": "ordinal", "domain": { "fields": [ {"data": "data_0", "field": "Origin"}, {"data": "data_1", "field": "Origin"}, {"data": "data_2", "field": "Origin"}, {"data": "data_3", "field": "Origin"}, {"data": "data_4", "field": "Origin"}, {"data": "data_5", "field": "Origin"} ], "sort": true }, "range": "category" }, { "name": "child__row_Horsepowercolumn_Miles_per_Gallon_x", "type": "linear", "domain": {"data": "data_0", "field": "Miles_per_Gallon"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Horsepowercolumn_Miles_per_Gallon_y", "type": "linear", "domain": {"data": "data_0", "field": "Horsepower"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__row_Horsepowercolumn_Acceleration_x", "type": "linear", "domain": {"data": "data_1", "field": "Acceleration"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Horsepowercolumn_Acceleration_y", "type": "linear", "domain": {"data": "data_1", "field": "Horsepower"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__row_Horsepowercolumn_Horsepower_x", "type": "linear", "domain": {"data": "data_2", "field": "Horsepower"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Horsepowercolumn_Horsepower_y", "type": "linear", "domain": {"data": "data_2", "field": "Horsepower"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__row_Accelerationcolumn_Miles_per_Gallon_x", "type": "linear", "domain": {"data": "data_3", "field": "Miles_per_Gallon"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Accelerationcolumn_Miles_per_Gallon_y", "type": "linear", "domain": {"data": "data_3", "field": "Acceleration"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__row_Accelerationcolumn_Acceleration_x", "type": "linear", "domain": {"data": "data_4", "field": "Acceleration"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Accelerationcolumn_Acceleration_y", "type": "linear", "domain": {"data": "data_4", "field": "Acceleration"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__row_Accelerationcolumn_Horsepower_x", "type": "linear", "domain": {"data": "data_1", "field": "Horsepower"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Accelerationcolumn_Horsepower_y", "type": "linear", "domain": {"data": "data_1", "field": "Acceleration"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_x", "type": "linear", "domain": {"data": "data_5", "field": "Miles_per_Gallon"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon_y", "type": "linear", "domain": {"data": "data_5", "field": "Miles_per_Gallon"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__row_Miles_per_Galloncolumn_Acceleration_x", "type": "linear", "domain": {"data": "data_3", "field": "Acceleration"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Miles_per_Galloncolumn_Acceleration_y", "type": "linear", "domain": {"data": "data_3", "field": "Miles_per_Gallon"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__row_Miles_per_Galloncolumn_Horsepower_x", "type": "linear", "domain": {"data": "data_0", "field": "Horsepower"}, "range": [0, {"signal": "childWidth"}], "nice": true, "zero": true }, { "name": "child__row_Miles_per_Galloncolumn_Horsepower_y", "type": "linear", "domain": {"data": "data_0", "field": "Miles_per_Gallon"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true } ], "legends": [ { "stroke": "color", "symbolType": "circle", "title": "Origin", "encode": { "symbols": { "update": { "fill": {"value": "transparent"}, "opacity": {"value": 0.7} } } } } ] }