{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "height": 400, "data": [ {"name": "selector014_store"}, {"name": "pickup_scales_store"}, {"name": "selector013_store"}, {"name": "selector015_store"}, { "name": "source_0", "values": [ { "VendorID": 2, "tpep_pickup_datetime": "2015-01-15 19:05:39", "tpep_dropoff_datetime": "2015-01-15 19:23:42", "passenger_count": 1, "trip_distance": 1.59, "pickup_x": -8236962.87845, "pickup_y": 4975552.61692, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8234835.38116, "dropoff_y": 4975627.16997, "payment_type": 1, "fare_amount": 12, "extra": 1, "mta_tax": 0.5, "tip_amount": 3.25, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 17.05 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:38", "tpep_dropoff_datetime": "2015-01-10 20:53:28", "passenger_count": 1, "trip_distance": 3.3, "pickup_x": -8237825.76757, "pickup_y": 4971752.28598, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8237020.63087, "dropoff_y": 4976875.03705, "payment_type": 1, "fare_amount": 14.5, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 2, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 17.8 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:39", "tpep_dropoff_datetime": "2015-01-10 20:35:31", "passenger_count": 1, "trip_distance": 0.5, "pickup_x": -8238653.83538, "pickup_y": 4970221.02621, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8238123.87198, "dropoff_y": 4971126.9786, "payment_type": 2, "fare_amount": 3.5, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 0, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 4.8 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:39", "tpep_dropoff_datetime": "2015-01-10 20:52:58", "passenger_count": 1, "trip_distance": 3, "pickup_x": -8234433.66211, "pickup_y": 4977362.79122, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8238107.73527, "dropoff_y": 4974456.80877, "payment_type": 2, "fare_amount": 15, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 0, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 16.3 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:39", "tpep_dropoff_datetime": "2015-01-10 20:58:31", "passenger_count": 1, "trip_distance": 2.2, "pickup_x": -8235780.65241, "pickup_y": 4972011.72183, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8236804.05929, "dropoff_y": 4975482.54878, "payment_type": 2, "fare_amount": 14, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 0, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 15.3 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:39", "tpep_dropoff_datetime": "2015-01-10 20:42:20", "passenger_count": 3, "trip_distance": 0.8, "pickup_x": -8237938.72451, "pickup_y": 4973206.44838, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8237086.8763, "dropoff_y": 4972058.2305, "payment_type": 1, "fare_amount": 7, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 1.66, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 9.96 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:40", "tpep_dropoff_datetime": "2015-01-10 20:40:44", "passenger_count": 2, "trip_distance": 0.9, "pickup_x": -8236037.99041, "pickup_y": 4978174.08688, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8236074.51032, "dropoff_y": 4976912.59886, "payment_type": 1, "fare_amount": 6.5, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 1.55, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 9.35 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:40", "tpep_dropoff_datetime": "2015-01-10 20:41:39", "passenger_count": 1, "trip_distance": 0.9, "pickup_x": -8236375.16263, "pickup_y": 4971584.74898, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8238131.51568, "dropoff_y": 4972389.96139, "payment_type": 1, "fare_amount": 7, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 1.66, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 9.96 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:41", "tpep_dropoff_datetime": "2015-01-10 20:43:26", "passenger_count": 1, "trip_distance": 1.1, "pickup_x": -8236950.13895, "pickup_y": 4975744.88647, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8234014.10776, "dropoff_y": 4976596.972, "payment_type": 1, "fare_amount": 7.5, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 1, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 9.8 }, { "VendorID": 1, "tpep_pickup_datetime": "2015-01-10 20:33:41", "tpep_dropoff_datetime": "2015-01-10 20:35:23", "passenger_count": 1, "trip_distance": 0.3, "pickup_x": -8238573.15185, "pickup_y": 4968834.52694, "RateCodeID": 1, "store_and_fwd_flag": "N", "dropoff_x": -8238730.2724, "dropoff_y": 4969326.36156, "payment_type": 2, "fare_amount": 3, "extra": 0.5, "mta_tax": 0.5, "tip_amount": 0, "tolls_amount": 0, "improvement_surcharge": 0.3, "total_amount": 4.3 } ] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "formula", "expr": "hours(datum.tpep_pickup_datetime)", "as": "pickup_hour" }, { "type": "formula", "expr": "day(datum.tpep_pickup_datetime)", "as": "pickup_day" }, {"type": "formula", "expr": "datum.tip_amount", "as": "tip_perc"}, {"type": "filter", "expr": "datum.tip_perc < 100"} ] }, { "name": "data_1", "source": "data_0", "transform": [ { "type": "filter", "expr": "(!length(data(\"selector013_store\")) || vlSelectionTest(\"selector013_store\", datum)) && (!length(data(\"selector015_store\")) || vlSelectionTest(\"selector015_store\", datum))" }, { "type": "bin", "field": "trip_distance", "as": [ "bin_extent_0_12_maxbins_20_trip_distance", "bin_extent_0_12_maxbins_20_trip_distance_end" ], "signal": "concat_0_bin_extent_0_12_maxbins_20_trip_distance_bins", "extent": [0, 12], "maxbins": 20 }, { "type": "aggregate", "groupby": [ "bin_extent_0_12_maxbins_20_trip_distance", "bin_extent_0_12_maxbins_20_trip_distance_end" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"bin_extent_0_12_maxbins_20_trip_distance\"]) && isFinite(+datum[\"bin_extent_0_12_maxbins_20_trip_distance\"])" } ] }, { "name": "data_2", "source": "data_0", "transform": [ { "type": "filter", "expr": "(!length(data(\"pickup_scales_store\")) || vlSelectionTest(\"pickup_scales_store\", datum)) && (!length(data(\"selector014_store\")) || vlSelectionTest(\"selector014_store\", datum)) && (!length(data(\"selector015_store\")) || vlSelectionTest(\"selector015_store\", datum))" }, { "type": "extent", "field": "pickup_x", "signal": "concat_1_bin_extent_param_pickup_scales_maxbins_50_pickup_x_extent" }, { "type": "bin", "field": "pickup_x", "as": [ "bin_extent_param_pickup_scales_maxbins_50_pickup_x", "bin_extent_param_pickup_scales_maxbins_50_pickup_x_end" ], "signal": "concat_1_bin_extent_param_pickup_scales_maxbins_50_pickup_x_bins", "extent": { "signal": "concat_1_bin_extent_param_pickup_scales_maxbins_50_pickup_x_extent" }, "span": {"signal": "span(pickup_scales[\"pickup_x\"])"}, "maxbins": 50 }, { "type": "extent", "field": "pickup_y", "signal": "concat_1_bin_extent_param_pickup_scales_maxbins_50_pickup_y_extent" }, { "type": "bin", "field": "pickup_y", "as": [ "bin_extent_param_pickup_scales_maxbins_50_pickup_y", "bin_extent_param_pickup_scales_maxbins_50_pickup_y_end" ], "signal": "concat_1_bin_extent_param_pickup_scales_maxbins_50_pickup_y_bins", "extent": { "signal": "concat_1_bin_extent_param_pickup_scales_maxbins_50_pickup_y_extent" }, "span": {"signal": "span(pickup_scales[\"pickup_x\"])"}, "maxbins": 50 }, { "type": "aggregate", "groupby": [ "bin_extent_param_pickup_scales_maxbins_50_pickup_x", "bin_extent_param_pickup_scales_maxbins_50_pickup_x_end", "bin_extent_param_pickup_scales_maxbins_50_pickup_y", "bin_extent_param_pickup_scales_maxbins_50_pickup_y_end" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_x\"]) && isFinite(+datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_x\"]) && isValid(datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_y\"]) && isFinite(+datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_y\"])" } ] }, { "name": "data_3", "source": "data_0", "transform": [ { "type": "filter", "expr": "(!length(data(\"selector013_store\")) || vlSelectionTest(\"selector013_store\", datum)) && (!length(data(\"selector014_store\")) || vlSelectionTest(\"selector014_store\", datum))" }, { "type": "aggregate", "groupby": ["pickup_day", "pickup_hour"], "ops": ["mean"], "fields": ["tip_perc"], "as": ["mean_tip_perc"] }, { "type": "filter", "expr": "isValid(datum[\"mean_tip_perc\"]) && isFinite(+datum[\"mean_tip_perc\"])" } ] } ], "signals": [ {"name": "concat_0_width", "value": 400}, {"name": "concat_1_width", "value": 400}, {"name": "concat_2_width", "value": 120}, { "name": "unit", "value": {}, "on": [ {"events": "mousemove", "update": "isTuple(group()) ? group() : unit"} ] }, { "name": "selector014", "update": "vlSelectionResolve(\"selector014_store\", \"union\")" }, { "name": "pickup_scales", "update": "{\"pickup_x\": pickup_scales_pickup_x, \"pickup_y\": pickup_scales_pickup_y}" }, {"name": "pickup_scales_pickup_x"}, {"name": "pickup_scales_pickup_y"}, { "name": "selector013", "update": "vlSelectionResolve(\"selector013_store\", \"union\")" }, { "name": "selector015", "update": "vlSelectionResolve(\"selector015_store\", \"union\")" } ], "layout": {"padding": 20, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", "name": "concat_0_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_0_width"}, "height": {"signal": "height"} } }, "signals": [ { "name": "selector014_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"selector014_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 !== \"selector014_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[selector014_x[0], clamp(x(unit), 0, concat_0_width)]" }, { "events": {"signal": "selector014_scale_trigger"}, "update": "[scale(\"concat_0_x\", selector014_trip_distance[0]), scale(\"concat_0_x\", selector014_trip_distance[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "selector014_translate_delta"}, "update": "clampRange(panLinear(selector014_translate_anchor.extent_x, selector014_translate_delta.x / span(selector014_translate_anchor.extent_x)), 0, concat_0_width)" }, { "events": {"signal": "selector014_zoom_delta"}, "update": "clampRange(zoomLinear(selector014_x, selector014_zoom_anchor.x, selector014_zoom_delta), 0, concat_0_width)" } ] }, { "name": "selector014_trip_distance", "on": [ { "events": {"signal": "selector014_x"}, "update": "selector014_x[0] === selector014_x[1] ? null : invert(\"concat_0_x\", selector014_x)" } ] }, { "name": "selector014_scale_trigger", "value": {}, "on": [ { "events": [{"scale": "concat_0_x"}], "update": "(!isArray(selector014_trip_distance) || (+invert(\"concat_0_x\", selector014_x)[0] === +selector014_trip_distance[0] && +invert(\"concat_0_x\", selector014_x)[1] === +selector014_trip_distance[1])) ? selector014_scale_trigger : {}" } ] }, { "name": "selector014_tuple", "on": [ { "events": [{"signal": "selector014_trip_distance"}], "update": "selector014_trip_distance ? {unit: \"concat_0\", fields: selector014_tuple_fields, values: [selector014_trip_distance]} : null" } ] }, { "name": "selector014_tuple_fields", "value": [{"field": "trip_distance", "channel": "x", "type": "R"}] }, { "name": "selector014_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "selector014_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(selector014_x)}" } ] }, { "name": "selector014_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "selector014_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: selector014_translate_anchor.x - x(unit), y: selector014_translate_anchor.y - y(unit)}" } ] }, { "name": "selector014_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "selector014_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "selector014_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "selector014_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "selector014_modify", "on": [ { "events": {"signal": "selector014_tuple"}, "update": "modify(\"selector014_store\", selector014_tuple, true)" } ] } ], "marks": [ { "name": "selector014_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": [ { "test": "data(\"selector014_store\").length && data(\"selector014_store\")[0].unit === \"concat_0\"", "signal": "selector014_x[0]" }, {"value": 0} ], "y": [ { "test": "data(\"selector014_store\").length && data(\"selector014_store\")[0].unit === \"concat_0\"", "value": 0 }, {"value": 0} ], "x2": [ { "test": "data(\"selector014_store\").length && data(\"selector014_store\")[0].unit === \"concat_0\"", "signal": "selector014_x[1]" }, {"value": 0} ], "y2": [ { "test": "data(\"selector014_store\").length && data(\"selector014_store\")[0].unit === \"concat_0\"", "field": {"group": "height"} }, {"value": 0} ] } } }, { "name": "concat_0_marks", "type": "rect", "style": ["bar"], "interactive": true, "from": {"data": "data_1"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"trip_distance (binned): \" + (!isValid(datum[\"bin_extent_0_12_maxbins_20_trip_distance\"]) || !isFinite(+datum[\"bin_extent_0_12_maxbins_20_trip_distance\"]) ? \"null\" : format(datum[\"bin_extent_0_12_maxbins_20_trip_distance\"], \"\") + \" – \" + format(datum[\"bin_extent_0_12_maxbins_20_trip_distance_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" }, "x2": { "scale": "concat_0_x", "field": "bin_extent_0_12_maxbins_20_trip_distance", "offset": 1 }, "x": { "scale": "concat_0_x", "field": "bin_extent_0_12_maxbins_20_trip_distance_end" }, "y": {"scale": "concat_0_y", "field": "__count"}, "y2": {"scale": "concat_0_y", "value": 0} } } }, { "name": "selector014_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": [ { "test": "data(\"selector014_store\").length && data(\"selector014_store\")[0].unit === \"concat_0\"", "signal": "selector014_x[0]" }, {"value": 0} ], "y": [ { "test": "data(\"selector014_store\").length && data(\"selector014_store\")[0].unit === \"concat_0\"", "value": 0 }, {"value": 0} ], "x2": [ { "test": "data(\"selector014_store\").length && data(\"selector014_store\")[0].unit === \"concat_0\"", "signal": "selector014_x[1]" }, {"value": 0} ], "y2": [ { "test": "data(\"selector014_store\").length && data(\"selector014_store\")[0].unit === \"concat_0\"", "field": {"group": "height"} }, {"value": 0} ], "stroke": [ { "test": "selector014_x[0] !== selector014_x[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "concat_0_y", "orient": "left", "gridScale": "concat_0_x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_0_x", "orient": "bottom", "grid": false, "title": "trip_distance (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_0_width/10)"}, "zindex": 0 }, { "scale": "concat_0_y", "orient": "left", "grid": false, "title": "Count of Records", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "concat_1_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_1_width"}, "height": {"signal": "height"} } }, "signals": [ { "name": "pickup_scales_pickup_x", "on": [ { "events": [{"source": "view", "type": "dblclick"}], "update": "null" }, { "events": {"signal": "pickup_scales_translate_delta"}, "update": "panLinear(pickup_scales_translate_anchor.extent_x, -pickup_scales_translate_delta.x / concat_1_width)" }, { "events": {"signal": "pickup_scales_zoom_delta"}, "update": "zoomLinear(domain(\"concat_1_x\"), pickup_scales_zoom_anchor.x, pickup_scales_zoom_delta)" } ], "push": "outer" }, { "name": "pickup_scales_pickup_y", "on": [ { "events": [{"source": "view", "type": "dblclick"}], "update": "null" }, { "events": {"signal": "pickup_scales_translate_delta"}, "update": "panLinear(pickup_scales_translate_anchor.extent_y, pickup_scales_translate_delta.y / height)" }, { "events": {"signal": "pickup_scales_zoom_delta"}, "update": "zoomLinear(domain(\"concat_1_y\"), pickup_scales_zoom_anchor.y, pickup_scales_zoom_delta)" } ], "push": "outer" }, { "name": "pickup_scales_tuple", "on": [ { "events": [ {"signal": "pickup_scales_pickup_x || pickup_scales_pickup_y"} ], "update": "pickup_scales_pickup_x && pickup_scales_pickup_y ? {unit: \"concat_1\", fields: pickup_scales_tuple_fields, values: [pickup_scales_pickup_x,pickup_scales_pickup_y]} : null" } ] }, { "name": "pickup_scales_tuple_fields", "value": [ {"field": "pickup_x", "channel": "x", "type": "R"}, {"field": "pickup_y", "channel": "y", "type": "R"} ] }, { "name": "pickup_scales_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "filter": ["event.altKey"] } ], "update": "{x: x(unit), y: y(unit), extent_x: domain(\"concat_1_x\"), extent_y: domain(\"concat_1_y\")}" } ] }, { "name": "pickup_scales_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "filter": ["event.altKey"], "between": [ { "source": "scope", "type": "mousedown", "filter": ["event.altKey"] }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: pickup_scales_translate_anchor.x - x(unit), y: pickup_scales_translate_anchor.y - y(unit)}" } ] }, { "name": "pickup_scales_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "filter": ["event.altKey"] } ], "update": "{x: invert(\"concat_1_x\", x(unit)), y: invert(\"concat_1_y\", y(unit))}" } ] }, { "name": "pickup_scales_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "filter": ["event.altKey"] } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "pickup_scales_modify", "on": [ { "events": {"signal": "pickup_scales_tuple"}, "update": "modify(\"pickup_scales_store\", pickup_scales_tuple, true)" } ] }, { "name": "selector013_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.altKey", "!event.item || event.item.mark.name !== \"selector013_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "filter": ["!event.altKey"], "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.altKey", "!event.item || event.item.mark.name !== \"selector013_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[selector013_x[0], clamp(x(unit), 0, concat_1_width)]" }, { "events": {"signal": "selector013_scale_trigger"}, "update": "[scale(\"concat_1_x\", selector013_pickup_x[0]), scale(\"concat_1_x\", selector013_pickup_x[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "selector013_translate_delta"}, "update": "clampRange(panLinear(selector013_translate_anchor.extent_x, selector013_translate_delta.x / span(selector013_translate_anchor.extent_x)), 0, concat_1_width)" }, { "events": {"signal": "selector013_zoom_delta"}, "update": "clampRange(zoomLinear(selector013_x, selector013_zoom_anchor.x, selector013_zoom_delta), 0, concat_1_width)" } ] }, { "name": "selector013_pickup_x", "on": [ { "events": {"signal": "selector013_x"}, "update": "selector013_x[0] === selector013_x[1] ? null : invert(\"concat_1_x\", selector013_x)" } ] }, { "name": "selector013_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.altKey", "!event.item || event.item.mark.name !== \"selector013_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "filter": ["!event.altKey"], "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.altKey", "!event.item || event.item.mark.name !== \"selector013_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[selector013_y[0], clamp(y(unit), 0, height)]" }, { "events": {"signal": "selector013_scale_trigger"}, "update": "[scale(\"concat_1_y\", selector013_pickup_y[0]), scale(\"concat_1_y\", selector013_pickup_y[1])]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "selector013_translate_delta"}, "update": "clampRange(panLinear(selector013_translate_anchor.extent_y, selector013_translate_delta.y / span(selector013_translate_anchor.extent_y)), 0, height)" }, { "events": {"signal": "selector013_zoom_delta"}, "update": "clampRange(zoomLinear(selector013_y, selector013_zoom_anchor.y, selector013_zoom_delta), 0, height)" } ] }, { "name": "selector013_pickup_y", "on": [ { "events": {"signal": "selector013_y"}, "update": "selector013_y[0] === selector013_y[1] ? null : invert(\"concat_1_y\", selector013_y)" } ] }, { "name": "selector013_scale_trigger", "value": {}, "on": [ { "events": [{"scale": "concat_1_x"}, {"scale": "concat_1_y"}], "update": "(!isArray(selector013_pickup_x) || (+invert(\"concat_1_x\", selector013_x)[0] === +selector013_pickup_x[0] && +invert(\"concat_1_x\", selector013_x)[1] === +selector013_pickup_x[1])) && (!isArray(selector013_pickup_y) || (+invert(\"concat_1_y\", selector013_y)[0] === +selector013_pickup_y[0] && +invert(\"concat_1_y\", selector013_y)[1] === +selector013_pickup_y[1])) ? selector013_scale_trigger : {}" } ] }, { "name": "selector013_tuple", "on": [ { "events": [ {"signal": "selector013_pickup_x || selector013_pickup_y"} ], "update": "selector013_pickup_x && selector013_pickup_y ? {unit: \"concat_1\", fields: selector013_tuple_fields, values: [selector013_pickup_x,selector013_pickup_y]} : null" } ] }, { "name": "selector013_tuple_fields", "value": [ {"field": "pickup_x", "channel": "x", "type": "R"}, {"field": "pickup_y", "channel": "y", "type": "R"} ] }, { "name": "selector013_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "filter": ["!event.altKey"], "markname": "selector013_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(selector013_x), extent_y: slice(selector013_y)}" } ] }, { "name": "selector013_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "filter": ["!event.altKey"], "between": [ { "source": "scope", "type": "mousedown", "filter": ["!event.altKey"], "markname": "selector013_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: selector013_translate_anchor.x - x(unit), y: selector013_translate_anchor.y - y(unit)}" } ] }, { "name": "selector013_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "filter": ["!event.altKey"], "markname": "selector013_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "selector013_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "filter": ["!event.altKey"], "markname": "selector013_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "selector013_modify", "on": [ { "events": {"signal": "selector013_tuple"}, "update": "modify(\"selector013_store\", selector013_tuple, true)" } ] } ], "marks": [ { "name": "selector013_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": [ { "test": "data(\"selector013_store\").length && data(\"selector013_store\")[0].unit === \"concat_1\"", "signal": "selector013_x[0]" }, {"value": 0} ], "y": [ { "test": "data(\"selector013_store\").length && data(\"selector013_store\")[0].unit === \"concat_1\"", "signal": "selector013_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"selector013_store\").length && data(\"selector013_store\")[0].unit === \"concat_1\"", "signal": "selector013_x[1]" }, {"value": 0} ], "y2": [ { "test": "data(\"selector013_store\").length && data(\"selector013_store\")[0].unit === \"concat_1\"", "signal": "selector013_y[1]" }, {"value": 0} ] } } }, { "name": "concat_1_marks", "type": "rect", "clip": true, "style": ["rect"], "interactive": true, "from": {"data": "data_2"}, "encode": { "update": { "fill": {"scale": "concat_1_color", "field": "__count"}, "opacity": {"scale": "opacity", "field": "__count"}, "description": { "signal": "\"pickup_x (binned): \" + (!isValid(datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_x\"]) || !isFinite(+datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_x\"]) ? \"null\" : format(datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_x\"], \"\") + \" – \" + format(datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_x_end\"], \"\")) + \"; pickup_y (binned): \" + (!isValid(datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_y\"]) || !isFinite(+datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_y\"]) ? \"null\" : format(datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_y\"], \"\") + \" – \" + format(datum[\"bin_extent_param_pickup_scales_maxbins_50_pickup_y_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" }, "x2": { "scale": "concat_1_x", "field": "bin_extent_param_pickup_scales_maxbins_50_pickup_x", "offset": 0.5 }, "x": { "scale": "concat_1_x", "field": "bin_extent_param_pickup_scales_maxbins_50_pickup_x_end", "offset": 0.5 }, "y2": { "scale": "concat_1_y", "field": "bin_extent_param_pickup_scales_maxbins_50_pickup_y", "offset": 0.5 }, "y": { "scale": "concat_1_y", "field": "bin_extent_param_pickup_scales_maxbins_50_pickup_y_end", "offset": 0.5 } } } }, { "name": "selector013_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": [ { "test": "data(\"selector013_store\").length && data(\"selector013_store\")[0].unit === \"concat_1\"", "signal": "selector013_x[0]" }, {"value": 0} ], "y": [ { "test": "data(\"selector013_store\").length && data(\"selector013_store\")[0].unit === \"concat_1\"", "signal": "selector013_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"selector013_store\").length && data(\"selector013_store\")[0].unit === \"concat_1\"", "signal": "selector013_x[1]" }, {"value": 0} ], "y2": [ { "test": "data(\"selector013_store\").length && data(\"selector013_store\")[0].unit === \"concat_1\"", "signal": "selector013_y[1]" }, {"value": 0} ], "stroke": [ { "test": "selector013_x[0] !== selector013_x[1] && selector013_y[0] !== selector013_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "concat_1_x", "orient": "bottom", "grid": false, "title": "pickup_x (binned)", "labels": false, "ticks": false, "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_1_width/10)"}, "zindex": 1 }, { "scale": "concat_1_y", "orient": "left", "grid": false, "title": "pickup_y (binned)", "labels": false, "ticks": false, "labelOverlap": true, "tickCount": {"signal": "ceil(height/10)"}, "zindex": 1 } ] }, { "type": "group", "name": "concat_2_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_2_width"}, "height": {"signal": "height"} } }, "signals": [ { "name": "selector015_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"selector015_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 !== \"selector015_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[selector015_x[0], clamp(x(unit), 0, concat_2_width)]" }, { "events": {"signal": "selector015_scale_trigger"}, "update": "[0, 0]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "selector015_translate_delta"}, "update": "clampRange(panLinear(selector015_translate_anchor.extent_x, selector015_translate_delta.x / span(selector015_translate_anchor.extent_x)), 0, concat_2_width)" }, { "events": {"signal": "selector015_zoom_delta"}, "update": "clampRange(zoomLinear(selector015_x, selector015_zoom_anchor.x, selector015_zoom_delta), 0, concat_2_width)" } ] }, { "name": "selector015_pickup_day", "on": [ { "events": {"signal": "selector015_x"}, "update": "selector015_x[0] === selector015_x[1] ? null : invert(\"concat_2_x\", selector015_x)" } ] }, { "name": "selector015_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"selector015_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 !== \"selector015_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[selector015_y[0], clamp(y(unit), 0, height)]" }, { "events": {"signal": "selector015_scale_trigger"}, "update": "[0, 0]" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "[0, 0]" }, { "events": {"signal": "selector015_translate_delta"}, "update": "clampRange(panLinear(selector015_translate_anchor.extent_y, selector015_translate_delta.y / span(selector015_translate_anchor.extent_y)), 0, height)" }, { "events": {"signal": "selector015_zoom_delta"}, "update": "clampRange(zoomLinear(selector015_y, selector015_zoom_anchor.y, selector015_zoom_delta), 0, height)" } ] }, { "name": "selector015_pickup_hour", "on": [ { "events": {"signal": "selector015_y"}, "update": "selector015_y[0] === selector015_y[1] ? null : invert(\"concat_2_y\", selector015_y)" } ] }, { "name": "selector015_scale_trigger", "value": {}, "on": [ { "events": [{"scale": "concat_2_x"}, {"scale": "concat_2_y"}], "update": "(!isArray(selector015_pickup_day) || (invert(\"concat_2_x\", selector015_x)[0] === selector015_pickup_day[0] && invert(\"concat_2_x\", selector015_x)[1] === selector015_pickup_day[1])) && (!isArray(selector015_pickup_hour) || (invert(\"concat_2_y\", selector015_y)[0] === selector015_pickup_hour[0] && invert(\"concat_2_y\", selector015_y)[1] === selector015_pickup_hour[1])) ? selector015_scale_trigger : {}" } ] }, { "name": "selector015_tuple", "on": [ { "events": [ {"signal": "selector015_pickup_day || selector015_pickup_hour"} ], "update": "selector015_pickup_day && selector015_pickup_hour ? {unit: \"concat_2\", fields: selector015_tuple_fields, values: [selector015_pickup_day,selector015_pickup_hour]} : null" } ] }, { "name": "selector015_tuple_fields", "value": [ {"field": "pickup_day", "channel": "x", "type": "E"}, {"field": "pickup_hour", "channel": "y", "type": "E"} ] }, { "name": "selector015_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "selector015_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(selector015_x), extent_y: slice(selector015_y)}" } ] }, { "name": "selector015_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "selector015_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: selector015_translate_anchor.x - x(unit), y: selector015_translate_anchor.y - y(unit)}" } ] }, { "name": "selector015_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "selector015_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "selector015_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "selector015_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "selector015_modify", "on": [ { "events": {"signal": "selector015_tuple"}, "update": "modify(\"selector015_store\", selector015_tuple, true)" } ] } ], "marks": [ { "name": "selector015_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": [ { "test": "data(\"selector015_store\").length && data(\"selector015_store\")[0].unit === \"concat_2\"", "signal": "selector015_x[0]" }, {"value": 0} ], "y": [ { "test": "data(\"selector015_store\").length && data(\"selector015_store\")[0].unit === \"concat_2\"", "signal": "selector015_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"selector015_store\").length && data(\"selector015_store\")[0].unit === \"concat_2\"", "signal": "selector015_x[1]" }, {"value": 0} ], "y2": [ { "test": "data(\"selector015_store\").length && data(\"selector015_store\")[0].unit === \"concat_2\"", "signal": "selector015_y[1]" }, {"value": 0} ] } } }, { "name": "concat_2_marks", "type": "rect", "style": ["rect"], "interactive": true, "from": {"data": "data_3"}, "encode": { "update": { "fill": {"scale": "concat_2_color", "field": "mean_tip_perc"}, "opacity": [ { "test": "!length(data(\"selector015_store\")) || vlSelectionTest(\"selector015_store\", datum)", "value": 1 }, {"value": 0.3} ], "description": { "signal": "\"pickup_day: \" + (isValid(datum[\"pickup_day\"]) ? datum[\"pickup_day\"] : \"\"+datum[\"pickup_day\"]) + \"; pickup_hour: \" + (isValid(datum[\"pickup_hour\"]) ? datum[\"pickup_hour\"] : \"\"+datum[\"pickup_hour\"]) + \"; Mean of tip_perc: \" + (format(datum[\"mean_tip_perc\"], \"\"))" }, "x": {"scale": "concat_2_x", "field": "pickup_day"}, "width": {"signal": "max(0.25, bandwidth('concat_2_x'))"}, "y": {"scale": "concat_2_y", "field": "pickup_hour"}, "height": {"signal": "max(0.25, bandwidth('concat_2_y'))"} } } }, { "name": "selector015_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": [ { "test": "data(\"selector015_store\").length && data(\"selector015_store\")[0].unit === \"concat_2\"", "signal": "selector015_x[0]" }, {"value": 0} ], "y": [ { "test": "data(\"selector015_store\").length && data(\"selector015_store\")[0].unit === \"concat_2\"", "signal": "selector015_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"selector015_store\").length && data(\"selector015_store\")[0].unit === \"concat_2\"", "signal": "selector015_x[1]" }, {"value": 0} ], "y2": [ { "test": "data(\"selector015_store\").length && data(\"selector015_store\")[0].unit === \"concat_2\"", "signal": "selector015_y[1]" }, {"value": 0} ], "stroke": [ { "test": "selector015_x[0] !== selector015_x[1] && selector015_y[0] !== selector015_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "concat_2_x", "orient": "bottom", "grid": false, "title": "pickup_day", "labelAlign": "right", "labelAngle": 270, "labelBaseline": "middle", "encode": { "labels": { "update": { "text": { "signal": "datum.label==1 ? 'Mon': datum.label==0? 'Sun': ''" } } } }, "zindex": 1 }, { "scale": "concat_2_y", "orient": "left", "grid": false, "title": "pickup_hour", "zindex": 1 } ], "legends": [ { "title": "Tip Ratio", "fill": "concat_2_color", "gradientLength": {"signal": "clamp(height, 64, 200)"}, "encode": {"gradient": {"update": {"opacity": {"value": 1}}}} } ] } ], "scales": [ { "name": "opacity", "type": "log", "domain": {"data": "data_2", "field": "__count"}, "range": [0.5, 1] }, { "name": "concat_0_x", "type": "linear", "domain": { "signal": "[concat_0_bin_extent_0_12_maxbins_20_trip_distance_bins.start, concat_0_bin_extent_0_12_maxbins_20_trip_distance_bins.stop]" }, "range": [0, {"signal": "concat_0_width"}], "bins": { "signal": "concat_0_bin_extent_0_12_maxbins_20_trip_distance_bins" }, "zero": false }, { "name": "concat_0_y", "type": "linear", "domain": {"data": "data_1", "field": "__count"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true }, { "name": "concat_1_x", "type": "linear", "domain": [-8243204, -8226511], "domainRaw": {"signal": "pickup_scales[\"pickup_x\"]"}, "range": [0, {"signal": "concat_1_width"}], "bins": { "signal": "concat_1_bin_extent_param_pickup_scales_maxbins_50_pickup_x_bins" }, "zero": false }, { "name": "concat_1_y", "type": "linear", "domain": [4968192, 4982886], "domainRaw": {"signal": "pickup_scales[\"pickup_y\"]"}, "range": [{"signal": "height"}, 0], "bins": { "signal": "concat_1_bin_extent_param_pickup_scales_maxbins_50_pickup_y_bins" }, "zero": false }, { "name": "concat_1_color", "type": "log", "domain": {"data": "data_2", "field": "__count"}, "range": {"scheme": "purpleblue"}, "reverse": false, "interpolate": "hcl" }, { "name": "concat_2_x", "type": "band", "domain": [1, 2, 3, 4, 5, 6, 0], "range": [0, {"signal": "concat_2_width"}], "paddingInner": 0, "paddingOuter": 0 }, { "name": "concat_2_y", "type": "band", "domain": {"data": "data_3", "field": "pickup_hour", "sort": true}, "range": [0, {"signal": "height"}], "paddingInner": 0, "paddingOuter": 0 }, { "name": "concat_2_color", "type": "linear", "domain": {"data": "data_3", "field": "mean_tip_perc"}, "range": "heatmap", "interpolate": "hcl", "zero": false } ] }