diff --git a/examples/compiled/interactive_airport_crossfilter.png b/examples/compiled/interactive_airport_crossfilter.png new file mode 100644 index 00000000000..d73893a7caa Binary files /dev/null and b/examples/compiled/interactive_airport_crossfilter.png differ diff --git a/examples/compiled/interactive_airport_crossfilter.svg b/examples/compiled/interactive_airport_crossfilter.svg new file mode 100644 index 00000000000..56da4fc0861 --- /dev/null +++ b/examples/compiled/interactive_airport_crossfilter.svg @@ -0,0 +1 @@ +02004006008001,0001,2001,4001,6001,8002,0002,2002,400distance (binned)02004006008001,000Count of Records−40−20020406080100120140160180200220240260delay (binned)0200400600800Count of Records \ No newline at end of file diff --git a/examples/compiled/interactive_airport_crossfilter.vg.json b/examples/compiled/interactive_airport_crossfilter.vg.json new file mode 100644 index 00000000000..ed44cc81794 --- /dev/null +++ b/examples/compiled/interactive_airport_crossfilter.vg.json @@ -0,0 +1,818 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "data": [ + { + "name": "brush_store", + "transform": [{"type": "collect", "sort": {"field": "_vgsid_"}}] + }, + {"name": "source_2", "url": "data/airports.csv", "format": {"type": "csv"}}, + { + "name": "source_0", + "url": "data/us-10m.json", + "format": {"type": "topojson", "feature": "states"}, + "transform": [{"type": "identifier", "as": "_vgsid_"}] + }, + { + "name": "source_1", + "url": "data/flights-airport.csv", + "format": {"type": "csv"}, + "transform": [ + {"type": "identifier", "as": "_vgsid_"}, + { + "type": "aggregate", + "groupby": ["origin"], + "ops": ["count"], + "fields": [null], + "as": ["routes"] + }, + {"type": "identifier", "as": "_vgsid_"}, + { + "type": "lookup", + "from": "source_2", + "key": "iata", + "fields": ["origin"], + "values": ["state", "latitude", "longitude"] + }, + { + "type": "filter", + "expr": "datum.state !== 'PR' && datum.state !== 'VI'" + }, + { + "type": "geojson", + "fields": ["longitude", "latitude"], + "signal": "concat_0_layer_1_geojson_0" + }, + { + "type": "geopoint", + "projection": "projection", + "fields": ["longitude", "latitude"], + "as": ["concat_0_layer_1_x", "concat_0_layer_1_y"] + }, + { + "type": "filter", + "expr": "isValid(datum[\"routes\"]) && isFinite(+datum[\"routes\"])" + } + ] + }, + { + "name": "data_0", + "source": "source_1", + "transform": [ + { + "type": "filter", + "expr": "!length(data(\"brush_store\")) || vlSelectionIdTest(\"brush_store\", datum)" + } + ] + }, + { + "name": "source_3", + "url": "data/flights-2k.json", + "format": {"type": "json", "parse": {"date": "date"}}, + "transform": [ + {"type": "identifier", "as": "_vgsid_"}, + { + "type": "extent", + "field": "delay", + "signal": "child__column_delay_layer_1_bin_maxbins_20_delay_extent" + }, + { + "type": "bin", + "field": "delay", + "as": ["bin_maxbins_20_delay", "bin_maxbins_20_delay_end"], + "signal": "child__column_delay_layer_1_bin_maxbins_20_delay_bins", + "extent": { + "signal": "child__column_delay_layer_1_bin_maxbins_20_delay_extent" + }, + "maxbins": 20 + }, + { + "type": "extent", + "field": "distance", + "signal": "child__column_distance_layer_0_bin_maxbins_20_distance_extent" + }, + { + "type": "bin", + "field": "distance", + "as": ["bin_maxbins_20_distance", "bin_maxbins_20_distance_end"], + "signal": "child__column_distance_layer_0_bin_maxbins_20_distance_bins", + "extent": { + "signal": "child__column_distance_layer_0_bin_maxbins_20_distance_extent" + }, + "maxbins": 20 + }, + { + "type": "lookup", + "from": "data_0", + "key": "origin", + "fields": ["origin"], + "as": ["brush"] + } + ] + }, + { + "name": "data_1", + "source": "source_3", + "transform": [ + { + "type": "filter", + "expr": "data('brush_store').length && isValid(datum.brush)" + } + ] + }, + { + "name": "data_2", + "source": "data_1", + "transform": [ + { + "type": "aggregate", + "groupby": ["bin_maxbins_20_delay", "bin_maxbins_20_delay_end"], + "ops": ["count"], + "fields": [null], + "as": ["__count"] + }, + { + "type": "filter", + "expr": "isValid(datum[\"bin_maxbins_20_delay\"]) && isFinite(+datum[\"bin_maxbins_20_delay\"])" + } + ] + }, + { + "name": "data_3", + "source": "data_1", + "transform": [ + { + "type": "aggregate", + "groupby": ["bin_maxbins_20_distance", "bin_maxbins_20_distance_end"], + "ops": ["count"], + "fields": [null], + "as": ["__count"] + }, + { + "type": "filter", + "expr": "isValid(datum[\"bin_maxbins_20_distance\"]) && isFinite(+datum[\"bin_maxbins_20_distance\"])" + } + ] + }, + { + "name": "data_4", + "source": "source_3", + "transform": [ + { + "type": "aggregate", + "groupby": ["bin_maxbins_20_distance", "bin_maxbins_20_distance_end"], + "ops": ["count"], + "fields": [null], + "as": ["__count"] + }, + { + "type": "filter", + "expr": "isValid(datum[\"bin_maxbins_20_distance\"]) && isFinite(+datum[\"bin_maxbins_20_distance\"])" + } + ] + }, + { + "name": "data_5", + "source": "source_3", + "transform": [ + { + "type": "aggregate", + "groupby": ["bin_maxbins_20_delay", "bin_maxbins_20_delay_end"], + "ops": ["count"], + "fields": [null], + "as": ["__count"] + }, + { + "type": "filter", + "expr": "isValid(datum[\"bin_maxbins_20_delay\"]) && isFinite(+datum[\"bin_maxbins_20_delay\"])" + } + ] + } + ], + "projections": [ + { + "name": "projection", + "size": {"signal": "[concat_0_width, concat_0_height]"}, + "fit": {"signal": "[data('source_0'), concat_0_layer_1_geojson_0]"}, + "type": "albersUsa" + } + ], + "signals": [ + {"name": "concat_0_width", "value": 500}, + {"name": "concat_0_height", "value": 300}, + {"name": "concat_1_childWidth", "value": 200}, + {"name": "concat_1_childHeight", "value": 200}, + { + "name": "unit", + "value": {}, + "on": [ + {"events": "mousemove", "update": "isTuple(group()) ? group() : unit"} + ] + }, + { + "name": "brush", + "update": "vlSelectionResolve(\"brush_store\", \"union\")" + } + ], + "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "style": "view", + "encode": { + "update": { + "width": {"signal": "concat_0_width"}, + "height": {"signal": "concat_0_height"} + } + }, + "signals": [ + { + "name": "brush_longitude_1", + "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_longitude_1[0], clamp(x(unit), 0, concat_0_width)]" + }, + { + "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, concat_0_width)" + }, + { + "events": {"signal": "brush_zoom_delta"}, + "update": "clampRange(zoomLinear(brush_longitude_1, brush_zoom_anchor.x, brush_zoom_delta), 0, concat_0_width)" + } + ] + }, + { + "name": "brush_latitude_1", + "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_latitude_1[0], clamp(y(unit), 0, concat_0_height)]" + }, + { + "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, concat_0_height)" + }, + { + "events": {"signal": "brush_zoom_delta"}, + "update": "clampRange(zoomLinear(brush_latitude_1, brush_zoom_anchor.y, brush_zoom_delta), 0, concat_0_height)" + } + ] + }, + { + "name": "brush_tuple", + "update": "vlSelectionTuples(intersect([[brush_longitude_1[0], brush_latitude_1[0]],[brush_longitude_1[1], brush_latitude_1[1]]], {markname: \"concat_0_layer_1_marks\"}, unit.mark), {unit: \"concat_0_layer_1\"})" + }, + { + "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_longitude_1), extent_y: slice(brush_latitude_1)}" + } + ] + }, + { + "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, true)" + } + ] + } + ], + "marks": [ + { + "name": "brush_brush_bg", + "type": "rect", + "clip": true, + "encode": { + "enter": { + "fill": {"value": "#333"}, + "fillOpacity": {"value": 0.125} + }, + "update": { + "x": [ + { + "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0_layer_1\"", + "signal": "brush_longitude_1[0]" + }, + {"value": 0} + ], + "y": [ + { + "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0_layer_1\"", + "signal": "brush_latitude_1[0]" + }, + {"value": 0} + ], + "x2": [ + { + "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0_layer_1\"", + "signal": "brush_longitude_1[1]" + }, + {"value": 0} + ], + "y2": [ + { + "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0_layer_1\"", + "signal": "brush_latitude_1[1]" + }, + {"value": 0} + ] + } + } + }, + { + "name": "concat_0_layer_0_marks", + "type": "shape", + "style": ["geoshape"], + "interactive": true, + "from": {"data": "source_0"}, + "encode": { + "update": { + "fill": {"value": "lightgray"}, + "stroke": {"value": "white"}, + "ariaRoleDescription": {"value": "geoshape"} + } + }, + "transform": [{"type": "geoshape", "projection": "projection"}] + }, + { + "name": "concat_0_layer_1_marks", + "type": "symbol", + "style": ["circle"], + "interactive": true, + "from": {"data": "source_1"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": [ + { + "test": "length(data(\"brush_store\")) && vlSelectionIdTest(\"brush_store\", datum)", + "value": "goldenrod" + }, + {"value": "steelblue"} + ], + "ariaRoleDescription": {"value": "circle"}, + "description": { + "signal": "\"longitude: \" + (format(datum[\"longitude\"], \"\")) + \"; latitude: \" + (format(datum[\"latitude\"], \"\")) + \"; routes: \" + (format(datum[\"routes\"], \"\"))" + }, + "x": {"field": "concat_0_layer_1_x"}, + "y": {"field": "concat_0_layer_1_y"}, + "size": {"scale": "size", "field": "routes"}, + "shape": {"value": "circle"} + } + } + }, + { + "name": "brush_brush", + "type": "rect", + "clip": true, + "encode": { + "enter": {"fill": {"value": "transparent"}}, + "update": { + "x": [ + { + "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0_layer_1\"", + "signal": "brush_longitude_1[0]" + }, + {"value": 0} + ], + "y": [ + { + "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0_layer_1\"", + "signal": "brush_latitude_1[0]" + }, + {"value": 0} + ], + "x2": [ + { + "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0_layer_1\"", + "signal": "brush_longitude_1[1]" + }, + {"value": 0} + ], + "y2": [ + { + "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0_layer_1\"", + "signal": "brush_latitude_1[1]" + }, + {"value": 0} + ], + "stroke": [ + { + "test": "brush_longitude_1[0] !== brush_longitude_1[1] && brush_latitude_1[0] !== brush_latitude_1[1]", + "value": "white" + }, + {"value": null} + ] + } + } + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "layout": {"padding": 20, "columns": 2, "bounds": "full", "align": "all"}, + "marks": [ + { + "type": "group", + "name": "child__column_distance_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "child__column_distance_layer_0_marks", + "type": "rect", + "style": ["bar"], + "interactive": false, + "from": {"data": "data_4"}, + "encode": { + "update": { + "fill": {"value": "steelblue"}, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"distance (binned): \" + (!isValid(datum[\"bin_maxbins_20_distance\"]) || !isFinite(+datum[\"bin_maxbins_20_distance\"]) ? \"null\" : format(datum[\"bin_maxbins_20_distance\"], \"\") + \" – \" + format(datum[\"bin_maxbins_20_distance_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" + }, + "x2": { + "scale": "child__column_distance_x", + "field": "bin_maxbins_20_distance", + "offset": 1 + }, + "x": { + "scale": "child__column_distance_x", + "field": "bin_maxbins_20_distance_end" + }, + "y": { + "scale": "child__column_distance_y", + "field": "__count" + }, + "y2": {"scale": "child__column_distance_y", "value": 0} + } + } + }, + { + "name": "child__column_distance_layer_1_marks", + "type": "rect", + "style": ["bar"], + "interactive": false, + "from": {"data": "data_3"}, + "encode": { + "update": { + "fill": {"value": "goldenrod"}, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"distance (binned): \" + (!isValid(datum[\"bin_maxbins_20_distance\"]) || !isFinite(+datum[\"bin_maxbins_20_distance\"]) ? \"null\" : format(datum[\"bin_maxbins_20_distance\"], \"\") + \" – \" + format(datum[\"bin_maxbins_20_distance_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" + }, + "x2": { + "scale": "child__column_distance_x", + "field": "bin_maxbins_20_distance", + "offset": 1 + }, + "x": { + "scale": "child__column_distance_x", + "field": "bin_maxbins_20_distance_end" + }, + "y": { + "scale": "child__column_distance_y", + "field": "__count" + }, + "y2": {"scale": "child__column_distance_y", "value": 0} + } + } + } + ], + "axes": [ + { + "scale": "child__column_distance_y", + "orient": "left", + "gridScale": "child__column_distance_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "child__column_distance_x", + "orient": "bottom", + "grid": false, + "title": "distance (binned)", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childWidth/10)"}, + "zindex": 0 + }, + { + "scale": "child__column_distance_y", + "orient": "left", + "grid": false, + "title": "Count of Records", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "child__column_delay_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "child__column_delay_layer_0_marks", + "type": "rect", + "style": ["bar"], + "interactive": false, + "from": {"data": "data_5"}, + "encode": { + "update": { + "fill": {"value": "steelblue"}, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"delay (binned): \" + (!isValid(datum[\"bin_maxbins_20_delay\"]) || !isFinite(+datum[\"bin_maxbins_20_delay\"]) ? \"null\" : format(datum[\"bin_maxbins_20_delay\"], \"\") + \" – \" + format(datum[\"bin_maxbins_20_delay_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" + }, + "x2": { + "scale": "child__column_delay_x", + "field": "bin_maxbins_20_delay", + "offset": 1 + }, + "x": { + "scale": "child__column_delay_x", + "field": "bin_maxbins_20_delay_end" + }, + "y": {"scale": "child__column_delay_y", "field": "__count"}, + "y2": {"scale": "child__column_delay_y", "value": 0} + } + } + }, + { + "name": "child__column_delay_layer_1_marks", + "type": "rect", + "style": ["bar"], + "interactive": false, + "from": {"data": "data_2"}, + "encode": { + "update": { + "fill": {"value": "goldenrod"}, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"delay (binned): \" + (!isValid(datum[\"bin_maxbins_20_delay\"]) || !isFinite(+datum[\"bin_maxbins_20_delay\"]) ? \"null\" : format(datum[\"bin_maxbins_20_delay\"], \"\") + \" – \" + format(datum[\"bin_maxbins_20_delay_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" + }, + "x2": { + "scale": "child__column_delay_x", + "field": "bin_maxbins_20_delay", + "offset": 1 + }, + "x": { + "scale": "child__column_delay_x", + "field": "bin_maxbins_20_delay_end" + }, + "y": {"scale": "child__column_delay_y", "field": "__count"}, + "y2": {"scale": "child__column_delay_y", "value": 0} + } + } + } + ], + "axes": [ + { + "scale": "child__column_delay_y", + "orient": "left", + "gridScale": "child__column_delay_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "child__column_delay_x", + "orient": "bottom", + "grid": false, + "title": "delay (binned)", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childWidth/10)"}, + "zindex": 0 + }, + { + "scale": "child__column_delay_y", + "orient": "left", + "grid": false, + "title": "Count of Records", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "size", + "type": "linear", + "domain": {"data": "source_1", "field": "routes"}, + "range": [0, 500], + "zero": true + }, + { + "name": "child__column_distance_x", + "type": "linear", + "domain": { + "signal": "[child__column_distance_layer_0_bin_maxbins_20_distance_bins.start, child__column_distance_layer_0_bin_maxbins_20_distance_bins.stop]" + }, + "range": [0, {"signal": "concat_1_childWidth"}], + "bins": { + "signal": "child__column_distance_layer_0_bin_maxbins_20_distance_bins" + }, + "zero": false + }, + { + "name": "child__column_distance_y", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_4", "field": "__count"}, + {"data": "data_3", "field": "__count"} + ] + }, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "child__column_delay_x", + "type": "linear", + "domain": { + "signal": "[child__column_delay_layer_1_bin_maxbins_20_delay_bins.start, child__column_delay_layer_1_bin_maxbins_20_delay_bins.stop]" + }, + "range": [0, {"signal": "concat_1_childWidth"}], + "bins": { + "signal": "child__column_delay_layer_1_bin_maxbins_20_delay_bins" + }, + "zero": false + }, + { + "name": "child__column_delay_y", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_5", "field": "__count"}, + {"data": "data_2", "field": "__count"} + ] + }, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + } + ] +} diff --git a/examples/specs/normalized/interactive_airport_crossfilter_normalized.vl.json b/examples/specs/normalized/interactive_airport_crossfilter_normalized.vl.json new file mode 100644 index 00000000000..ae486c5df4c --- /dev/null +++ b/examples/specs/normalized/interactive_airport_crossfilter_normalized.vl.json @@ -0,0 +1,119 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "vconcat": [ + { + "width": 500, + "height": 300, + "layer": [ + { + "data": { + "url": "data/us-10m.json", + "format": {"type": "topojson", "feature": "states"} + }, + "mark": {"type": "geoshape", "fill": "lightgray", "stroke": "white"}, + "projection": {"type": "albersUsa"} + }, + { + "data": {"url": "data/flights-airport.csv"}, + "params": [{"name": "brush", "select": "interval"}], + "mark": "circle", + "encoding": { + "longitude": {"field": "longitude", "type": "quantitative"}, + "latitude": {"field": "latitude", "type": "quantitative"}, + "size": { + "field": "routes", + "type": "quantitative", + "scale": {"rangeMax": 500}, + "legend": null + }, + "color": { + "condition": { + "param": "brush", + "empty": false, + "value": "goldenrod" + }, + "value": "steelblue" + } + }, + "transform": [ + { + "aggregate": [{"op": "count", "as": "routes"}], + "groupby": ["origin"] + }, + { + "lookup": "origin", + "from": { + "data": {"url": "data/airports.csv"}, + "key": "iata", + "fields": ["state", "latitude", "longitude"] + } + }, + {"filter": "datum.state !== 'PR' && datum.state !== 'VI'"} + ], + "projection": {"type": "albersUsa"} + } + ] + }, + { + "data": { + "url": "data/flights-2k.json", + "format": {"parse": {"date": "date"}} + }, + "align": "all", + "transform": [ + {"lookup": "origin", "from": {"param": "brush", "key": "origin"}} + ], + "columns": 2, + "concat": [ + { + "layer": [ + { + "mark": "bar", + "encoding": { + "x": {"field": "distance", "bin": {"maxbins": 20}}, + "y": {"aggregate": "count"}, + "color": {"value": "steelblue"} + } + }, + { + "mark": "bar", + "encoding": { + "x": {"field": "distance", "bin": {"maxbins": 20}}, + "y": {"aggregate": "count"}, + "color": {"value": "goldenrod"} + }, + "transform": [ + {"filter": "data('brush_store').length && isValid(datum.brush)"} + ] + } + ], + "name": "child__column_distance" + }, + { + "layer": [ + { + "mark": "bar", + "encoding": { + "x": {"field": "delay", "bin": {"maxbins": 20}}, + "y": {"aggregate": "count"}, + "color": {"value": "steelblue"} + } + }, + { + "mark": "bar", + "encoding": { + "x": {"field": "delay", "bin": {"maxbins": 20}}, + "y": {"aggregate": "count"}, + "color": {"value": "goldenrod"} + }, + "transform": [ + {"filter": "data('brush_store').length && isValid(datum.brush)"} + ] + } + ], + "name": "child__column_delay" + } + ] + } + ] +} \ No newline at end of file