From dbceb5f250a92bc1581ec231a632c72102504590 Mon Sep 17 00:00:00 2001 From: Arvind Satyanarayan Date: Thu, 1 Oct 2020 09:29:20 -0400 Subject: [PATCH 1/8] refactor: rename unit `selection` property to `params`. --- examples/specs/airport_connections.vl.json | 2 +- examples/specs/bar_count_minimap.vl.json | 2 +- examples/specs/brush_table.vl.json | 2 +- .../specs/circle_bubble_health_income.vl.json | 2 +- .../specs/concat_bar_layer_circle.vl.json | 2 +- examples/specs/concat_hover.vl.json | 4 +- examples/specs/concat_hover_filter.vl.json | 4 +- examples/specs/interactive_area_brush.vl.json | 2 +- .../interactive_bar_select_highlight.vl.json | 2 +- examples/specs/interactive_bin_extent.vl.json | 2 +- examples/specs/interactive_brush.vl.json | 2 +- .../specs/interactive_concat_layer.vl.json | 2 +- .../interactive_dashboard_europe_pop.vl.json | 6 +-- .../interactive_global_development.vl.json | 2 +- .../specs/interactive_index_chart.vl.json | 2 +- .../interactive_layered_crossfilter.vl.json | 2 +- ...ctive_layered_crossfilter_discrete.vl.json | 2 +- examples/specs/interactive_legend.vl.json | 2 +- .../specs/interactive_legend_dblclick.vl.json | 2 +- .../interactive_line_brush_cursor.vl.json | 2 +- examples/specs/interactive_line_hover.vl.json | 2 +- .../interactive_multi_line_label.vl.json | 2 +- ...teractive_multi_line_pivot_tooltip.vl.json | 2 +- .../interactive_multi_line_tooltip.vl.json | 2 +- .../specs/interactive_overview_detail.vl.json | 2 +- examples/specs/interactive_paintbrush.vl.json | 2 +- .../interactive_paintbrush_color.vl.json | 2 +- ...teractive_paintbrush_color_nearest.vl.json | 2 +- .../interactive_paintbrush_interval.vl.json | 2 +- .../interactive_paintbrush_simple_all.vl.json | 2 +- ...interactive_paintbrush_simple_none.vl.json | 2 +- .../specs/interactive_panzoom_splom.vl.json | 2 +- ...interactive_panzoom_vconcat_shared.vl.json | 2 +- .../specs/interactive_query_widgets.vl.json | 2 +- .../specs/interactive_seattle_weather.vl.json | 4 +- examples/specs/interactive_splom.vl.json | 2 +- .../interactive_stocks_nearest_index.vl.json | 2 +- examples/specs/isotype_grid.vl.json | 2 +- .../airport_connections_normalized.vl.json | 4 +- .../concat_hover_filter_normalized.vl.json | 6 +-- .../interactive_area_brush_normalized.vl.json | 6 +-- ...tive_global_development_normalized.vl.json | 19 +++------- ...interactive_index_chart_normalized.vl.json | 4 +- ...ed_crossfilter_discrete_normalized.vl.json | 14 ++----- ...ive_layered_crossfilter_normalized.vl.json | 8 ++-- .../interactive_line_hover_normalized.vl.json | 4 +- ...active_multi_line_label_normalized.vl.json | 4 +- ...ulti_line_pivot_tooltip_normalized.vl.json | 4 +- ...tive_multi_line_tooltip_normalized.vl.json | 4 +- ...teractive_panzoom_splom_normalized.vl.json | 20 +++++----- .../interactive_splom_normalized.vl.json | 20 +++++----- ...ve_stocks_nearest_index_normalized.vl.json | 12 ++---- ...ction_resolution_global_normalized.vl.json | 38 +++++-------------- ...on_resolution_intersect_normalized.vl.json | 20 +++++----- ...ection_resolution_union_normalized.vl.json | 38 +++++-------------- .../trellis_selections_normalized.vl.json | 4 +- examples/specs/selection_bind_cylyr.vl.json | 2 +- examples/specs/selection_bind_origin.vl.json | 2 +- .../specs/selection_brush_timeunit.vl.json | 2 +- examples/specs/selection_clear_brush.vl.json | 2 +- .../specs/selection_composition_and.vl.json | 2 +- .../specs/selection_composition_or.vl.json | 2 +- examples/specs/selection_concat.vl.json | 4 +- examples/specs/selection_filter.vl.json | 2 +- .../selection_filter_composition.vl.json | 2 +- examples/specs/selection_heatmap.vl.json | 2 +- examples/specs/selection_insert.vl.json | 2 +- .../selection_interval_mark_style.vl.json | 2 +- examples/specs/selection_layer.json | 4 +- .../specs/selection_layer_bar_month.vl.json | 2 +- .../specs/selection_multi_condition.vl.json | 2 +- .../selection_project_binned_interval.vl.json | 2 +- .../specs/selection_project_interval.vl.json | 2 +- .../selection_project_interval_x.vl.json | 2 +- .../selection_project_interval_x_y.vl.json | 2 +- .../selection_project_interval_y.vl.json | 2 +- .../specs/selection_project_multi.vl.json | 2 +- .../selection_project_multi_cylinders.vl.json | 2 +- ...ion_project_multi_cylinders_origin.vl.json | 2 +- .../selection_project_multi_origin.vl.json | 2 +- .../specs/selection_project_single.vl.json | 2 +- ...selection_project_single_cylinders.vl.json | 2 +- ...on_project_single_cylinders_origin.vl.json | 2 +- .../selection_project_single_origin.vl.json | 2 +- .../specs/selection_resolution_global.vl.json | 2 +- .../selection_resolution_intersect.vl.json | 2 +- .../specs/selection_resolution_union.vl.json | 2 +- .../specs/selection_toggle_altKey.vl.json | 2 +- .../selection_toggle_altKey_shiftKey.vl.json | 2 +- .../specs/selection_toggle_shiftKey.vl.json | 2 +- .../selection_translate_brush_drag.vl.json | 2 +- ...lection_translate_brush_shift-drag.vl.json | 2 +- ...lection_translate_scatterplot_drag.vl.json | 2 +- ...n_translate_scatterplot_shift-drag.vl.json | 2 +- .../specs/selection_type_interval.vl.json | 2 +- .../selection_type_interval_invert.vl.json | 2 +- examples/specs/selection_type_multi.vl.json | 2 +- examples/specs/selection_type_single.vl.json | 2 +- .../selection_type_single_dblclick.vl.json | 2 +- .../selection_type_single_mouseover.vl.json | 2 +- .../selection_zoom_brush_shift-wheel.vl.json | 2 +- .../specs/selection_zoom_brush_wheel.vl.json | 2 +- ...ction_zoom_scatterplot_shift-wheel.vl.json | 2 +- .../selection_zoom_scatterplot_wheel.vl.json | 2 +- examples/specs/trellis_selections.vl.json | 2 +- examples/specs/vconcat_flatten.vl.json | 2 +- src/compile/unit.ts | 2 +- src/compositemark/boxplot.ts | 4 +- src/compositemark/errorbar.ts | 4 +- src/normalize/core.ts | 12 +++--- src/normalize/pathoverlay.ts | 10 ++--- src/spec/unit.ts | 2 +- test-runtime/util.ts | 6 +-- test/compile/data/bin.test.ts | 6 +-- test/compile/data/formatparse.test.ts | 2 +- test/compile/mark/init.test.ts | 4 +- test/compile/mark/mark.test.ts | 4 +- test/compile/mark/point.test.ts | 2 +- test/compile/selection/facets.test.ts | 2 +- test/compile/selection/identifier.test.ts | 6 +-- test/compile/selection/layers.test.ts | 4 +- test/compile/selection/parse.test.ts | 2 +- test/compile/selection/scales.test.ts | 20 +++++----- test/compile/selection/timeunit.test.ts | 2 +- 124 files changed, 228 insertions(+), 285 deletions(-) diff --git a/examples/specs/airport_connections.vl.json b/examples/specs/airport_connections.vl.json index 092f7d9000..142203e67c 100644 --- a/examples/specs/airport_connections.vl.json +++ b/examples/specs/airport_connections.vl.json @@ -59,7 +59,7 @@ }, {"filter": "datum.state !== 'PR' && datum.state !== 'VI'"} ], - "selection": [{ + "params": [{ "name": "org", "select": { "type": "single", diff --git a/examples/specs/bar_count_minimap.vl.json b/examples/specs/bar_count_minimap.vl.json index 5727f57e55..53c3d9965c 100644 --- a/examples/specs/bar_count_minimap.vl.json +++ b/examples/specs/bar_count_minimap.vl.json @@ -22,7 +22,7 @@ }, { "height": 200, "width": 50, - "selection": [{ + "params": [{ "name": "brush", "select": { "type": "interval", diff --git a/examples/specs/brush_table.vl.json b/examples/specs/brush_table.vl.json index efd4e63ff3..df2344f500 100644 --- a/examples/specs/brush_table.vl.json +++ b/examples/specs/brush_table.vl.json @@ -6,7 +6,7 @@ "window": [{"op": "row_number", "as": "row_number"}] }], "hconcat": [{ - "selection": [{"name": "brush", "select": "interval"}], + "params": [{"name": "brush", "select": "interval"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, diff --git a/examples/specs/circle_bubble_health_income.vl.json b/examples/specs/circle_bubble_health_income.vl.json index 9234174a57..3813462017 100644 --- a/examples/specs/circle_bubble_health_income.vl.json +++ b/examples/specs/circle_bubble_health_income.vl.json @@ -5,7 +5,7 @@ "data": { "url": "data/gapminder-health-income.csv" }, - "selection": [{ + "params": [{ "name": "view", "select": "interval", "bind": "scales" diff --git a/examples/specs/concat_bar_layer_circle.vl.json b/examples/specs/concat_bar_layer_circle.vl.json index 449c53a60d..a7bdd3fe1a 100644 --- a/examples/specs/concat_bar_layer_circle.vl.json +++ b/examples/specs/concat_bar_layer_circle.vl.json @@ -46,7 +46,7 @@ "width": 330, "height": 120, "mark": "bar", - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "single", "encodings": ["x"]} }], diff --git a/examples/specs/concat_hover.vl.json b/examples/specs/concat_hover.vl.json index 668b232a9b..f3cd15c0b8 100644 --- a/examples/specs/concat_hover.vl.json +++ b/examples/specs/concat_hover.vl.json @@ -3,7 +3,7 @@ "description": "Drag out a rectangular brush to highlight points.", "data": {"url": "data/cars.json"}, "hconcat": [{ - "selection": [{ + "params": [{ "name": "hover", "select": { "type": "single", @@ -21,7 +21,7 @@ } } },{ - "selection": [{ + "params": [{ "name": "hover", "select": { "type": "single", diff --git a/examples/specs/concat_hover_filter.vl.json b/examples/specs/concat_hover_filter.vl.json index 4b1388fa27..bc8b01ddfa 100644 --- a/examples/specs/concat_hover_filter.vl.json +++ b/examples/specs/concat_hover_filter.vl.json @@ -9,7 +9,7 @@ }, "layer": [ { - "selection": [{ + "params": [{ "name": "hover", "select": { "type": "single", @@ -32,7 +32,7 @@ "layer": [ { - "selection": [{ + "params": [{ "name": "hover", "select": { "type": "single", diff --git a/examples/specs/interactive_area_brush.vl.json b/examples/specs/interactive_area_brush.vl.json index 7e0b3d4f70..304cfb5671 100644 --- a/examples/specs/interactive_area_brush.vl.json +++ b/examples/specs/interactive_area_brush.vl.json @@ -6,7 +6,7 @@ "y": {"aggregate": "sum", "field": "count"} }, "layer": [{ - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["x"]} }], diff --git a/examples/specs/interactive_bar_select_highlight.vl.json b/examples/specs/interactive_bar_select_highlight.vl.json index 71ac1cb6f5..3574b6a6fa 100644 --- a/examples/specs/interactive_bar_select_highlight.vl.json +++ b/examples/specs/interactive_bar_select_highlight.vl.json @@ -8,7 +8,7 @@ {"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52} ] }, - "selection": [ + "params": [ { "name": "highlight", "select": { diff --git a/examples/specs/interactive_bin_extent.vl.json b/examples/specs/interactive_bin_extent.vl.json index bd51c43881..36522c088b 100644 --- a/examples/specs/interactive_bin_extent.vl.json +++ b/examples/specs/interactive_bin_extent.vl.json @@ -8,7 +8,7 @@ "vconcat": [{ "width": 963, "height": 100, - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["x"]} }], diff --git a/examples/specs/interactive_brush.vl.json b/examples/specs/interactive_brush.vl.json index 01a46473d1..7bbf414c51 100644 --- a/examples/specs/interactive_brush.vl.json +++ b/examples/specs/interactive_brush.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "description": "Drag out a rectangular brush to highlight points.", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "brush", "select": "interval", "value": {"x": [55, 160], "y": [13, 37]} diff --git a/examples/specs/interactive_concat_layer.vl.json b/examples/specs/interactive_concat_layer.vl.json index dad06f7b9e..89e7ef5296 100644 --- a/examples/specs/interactive_concat_layer.vl.json +++ b/examples/specs/interactive_concat_layer.vl.json @@ -51,7 +51,7 @@ "width": 330, "height": 120, "mark": "bar", - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "single", "encodings": ["x"]} }], diff --git a/examples/specs/interactive_dashboard_europe_pop.vl.json b/examples/specs/interactive_dashboard_europe_pop.vl.json index 1ced44eed0..7ac4e71b24 100644 --- a/examples/specs/interactive_dashboard_europe_pop.vl.json +++ b/examples/specs/interactive_dashboard_europe_pop.vl.json @@ -308,7 +308,7 @@ { "mark": "bar", "height": 700, - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["y"]} }], @@ -331,7 +331,7 @@ { "mark": "bar", "height": 700, - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["y"]} }], @@ -355,7 +355,7 @@ "mark": "point", "width": 260, "height": 260, - "selection": [{"name": "brush", "select": "interval"}], + "params": [{"name": "brush", "select": "interval"}], "encoding": { "y": { "field": "Population_ages_15_64_of_total", diff --git a/examples/specs/interactive_global_development.vl.json b/examples/specs/interactive_global_development.vl.json index 54f82dc391..26313a982a 100644 --- a/examples/specs/interactive_global_development.vl.json +++ b/examples/specs/interactive_global_development.vl.json @@ -76,7 +76,7 @@ } }, { - "selection": [ + "params": [ { "name": "year", "value": {"year": 1955}, diff --git a/examples/specs/interactive_index_chart.vl.json b/examples/specs/interactive_index_chart.vl.json index 965a13ee62..3c11b716e5 100644 --- a/examples/specs/interactive_index_chart.vl.json +++ b/examples/specs/interactive_index_chart.vl.json @@ -8,7 +8,7 @@ "height": 300, "layer": [ { - "selection": [{ + "params": [{ "name": "index", "value": {"x": {"year": 2005, "month": 1, "date": 1}}, "select": { diff --git a/examples/specs/interactive_layered_crossfilter.vl.json b/examples/specs/interactive_layered_crossfilter.vl.json index 51fdcd4cf9..c0107e866b 100644 --- a/examples/specs/interactive_layered_crossfilter.vl.json +++ b/examples/specs/interactive_layered_crossfilter.vl.json @@ -8,7 +8,7 @@ "repeat": {"column": ["distance", "delay", "time"]}, "spec": { "layer": [{ - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["x"]} }], diff --git a/examples/specs/interactive_layered_crossfilter_discrete.vl.json b/examples/specs/interactive_layered_crossfilter_discrete.vl.json index 2b51a3a707..53bedc43de 100644 --- a/examples/specs/interactive_layered_crossfilter_discrete.vl.json +++ b/examples/specs/interactive_layered_crossfilter_discrete.vl.json @@ -8,7 +8,7 @@ "repeat": {"column": ["distance", "delay", "time"]}, "spec": { "layer": [{ - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "multi", "encodings": ["x"]} }], diff --git a/examples/specs/interactive_legend.vl.json b/examples/specs/interactive_legend.vl.json index 03d0ed1632..3f9ad468ac 100644 --- a/examples/specs/interactive_legend.vl.json +++ b/examples/specs/interactive_legend.vl.json @@ -3,7 +3,7 @@ "width": 300, "height": 200, "data": {"url": "data/unemployment-across-industries.json"}, "mark": "area", - "selection": [{ + "params": [{ "name": "industry", "select": {"type": "multi", "fields": ["series"]}, "bind": "legend" diff --git a/examples/specs/interactive_legend_dblclick.vl.json b/examples/specs/interactive_legend_dblclick.vl.json index 5ec685e5a4..9d1c26ff24 100644 --- a/examples/specs/interactive_legend_dblclick.vl.json +++ b/examples/specs/interactive_legend_dblclick.vl.json @@ -3,7 +3,7 @@ "width": 300, "height": 200, "data": {"url": "data/unemployment-across-industries.json"}, "mark": "area", - "selection": [{ + "params": [{ "name": "industry", "select": {"type": "multi", "fields": ["series"]}, "bind": {"legend": "dblclick"} diff --git a/examples/specs/interactive_line_brush_cursor.vl.json b/examples/specs/interactive_line_brush_cursor.vl.json index 6c689380f2..ff470ec162 100644 --- a/examples/specs/interactive_line_brush_cursor.vl.json +++ b/examples/specs/interactive_line_brush_cursor.vl.json @@ -17,7 +17,7 @@ "type": "quantitative" } }, - "selection": [{ + "params": [{ "name": "brush", "select": { "type": "interval", diff --git a/examples/specs/interactive_line_hover.vl.json b/examples/specs/interactive_line_hover.vl.json index 290d00e87e..bb9798d8cf 100644 --- a/examples/specs/interactive_line_hover.vl.json +++ b/examples/specs/interactive_line_hover.vl.json @@ -25,7 +25,7 @@ }, "layer": [{ "description": "transparent layer to make it easier to trigger selection", - "selection": [{ + "params": [{ "name": "hover", "value": {"symbol": "AAPL"}, "select": { diff --git a/examples/specs/interactive_multi_line_label.vl.json b/examples/specs/interactive_multi_line_label.vl.json index f87368680e..b6f90a9e9e 100644 --- a/examples/specs/interactive_multi_line_label.vl.json +++ b/examples/specs/interactive_multi_line_label.vl.json @@ -15,7 +15,7 @@ "layer": [ {"mark": "line"}, { - "selection": [{ + "params": [{ "name": "label", "select": { "type": "single", diff --git a/examples/specs/interactive_multi_line_pivot_tooltip.vl.json b/examples/specs/interactive_multi_line_pivot_tooltip.vl.json index faf0092476..fe534e7020 100644 --- a/examples/specs/interactive_multi_line_pivot_tooltip.vl.json +++ b/examples/specs/interactive_multi_line_pivot_tooltip.vl.json @@ -31,7 +31,7 @@ {"field": "MSFT", "type": "quantitative"} ] }, - "selection": [{ + "params": [{ "name": "hover", "select": { "type": "single", diff --git a/examples/specs/interactive_multi_line_tooltip.vl.json b/examples/specs/interactive_multi_line_tooltip.vl.json index c6756ab579..c45f603961 100644 --- a/examples/specs/interactive_multi_line_tooltip.vl.json +++ b/examples/specs/interactive_multi_line_tooltip.vl.json @@ -21,7 +21,7 @@ } }, { "mark": "rule", - "selection": [{ + "params": [{ "name": "hover", "select": {"type": "single", "on": "mouseover", "empty": "none"} }], diff --git a/examples/specs/interactive_overview_detail.vl.json b/examples/specs/interactive_overview_detail.vl.json index c92adceb5c..ea1ce01531 100644 --- a/examples/specs/interactive_overview_detail.vl.json +++ b/examples/specs/interactive_overview_detail.vl.json @@ -17,7 +17,7 @@ "width": 480, "height": 60, "mark": "area", - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["x"]} }], diff --git a/examples/specs/interactive_paintbrush.vl.json b/examples/specs/interactive_paintbrush.vl.json index 5baf897531..8d61b4d5da 100644 --- a/examples/specs/interactive_paintbrush.vl.json +++ b/examples/specs/interactive_paintbrush.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "description": "Select multiple points with the shift key.", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "paintbrush", "select": {"type": "multi", "on": "mouseover", "nearest": true} }], diff --git a/examples/specs/interactive_paintbrush_color.vl.json b/examples/specs/interactive_paintbrush_color.vl.json index 6ab44a46c1..4ec01836de 100644 --- a/examples/specs/interactive_paintbrush_color.vl.json +++ b/examples/specs/interactive_paintbrush_color.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "description": "Select multiple points with the shift key.", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "paintbrush", "select": { "type": "multi", diff --git a/examples/specs/interactive_paintbrush_color_nearest.vl.json b/examples/specs/interactive_paintbrush_color_nearest.vl.json index 3801e098aa..f76002fa38 100644 --- a/examples/specs/interactive_paintbrush_color_nearest.vl.json +++ b/examples/specs/interactive_paintbrush_color_nearest.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "description": "Select multiple points with the shift key.", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "paintbrush", "select": { "type": "multi", diff --git a/examples/specs/interactive_paintbrush_interval.vl.json b/examples/specs/interactive_paintbrush_interval.vl.json index 34a5134546..8c1ebbed2b 100644 --- a/examples/specs/interactive_paintbrush_interval.vl.json +++ b/examples/specs/interactive_paintbrush_interval.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "description": "Select multiple points by dragging an interval.", "data": {"url": "data/cars.json"}, - "selection": [{"name": "paintbrush", "select": "interval"}], + "params": [{"name": "paintbrush", "select": "interval"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, diff --git a/examples/specs/interactive_paintbrush_simple_all.vl.json b/examples/specs/interactive_paintbrush_simple_all.vl.json index 0439001448..c7c34ea390 100644 --- a/examples/specs/interactive_paintbrush_simple_all.vl.json +++ b/examples/specs/interactive_paintbrush_simple_all.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "paintbrush", "select": {"type": "multi", "on": "mouseover", "empty": "all"} }], diff --git a/examples/specs/interactive_paintbrush_simple_none.vl.json b/examples/specs/interactive_paintbrush_simple_none.vl.json index 10733f76cd..f70c60ffef 100644 --- a/examples/specs/interactive_paintbrush_simple_none.vl.json +++ b/examples/specs/interactive_paintbrush_simple_none.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "paintbrush", "select": {"type": "multi", "on": "mouseover", "empty": "none"} }], diff --git a/examples/specs/interactive_panzoom_splom.vl.json b/examples/specs/interactive_panzoom_splom.vl.json index f917a27ca2..7c34e57f1c 100644 --- a/examples/specs/interactive_panzoom_splom.vl.json +++ b/examples/specs/interactive_panzoom_splom.vl.json @@ -6,7 +6,7 @@ "column": ["Miles_per_Gallon", "Acceleration", "Horsepower"] }, "spec": { - "selection": [{ + "params": [{ "name": "grid", "select": "interval", "bind": "scales" diff --git a/examples/specs/interactive_panzoom_vconcat_shared.vl.json b/examples/specs/interactive_panzoom_vconcat_shared.vl.json index b176625679..adce92e406 100644 --- a/examples/specs/interactive_panzoom_vconcat_shared.vl.json +++ b/examples/specs/interactive_panzoom_vconcat_shared.vl.json @@ -3,7 +3,7 @@ "data": {"url": "data/cars.json"}, "vconcat": [ { - "selection": [{ + "params": [{ "name": "region", "select": "interval", "bind": "scales" diff --git a/examples/specs/interactive_query_widgets.vl.json b/examples/specs/interactive_query_widgets.vl.json index 4432dfc9ae..ffab776c9a 100644 --- a/examples/specs/interactive_query_widgets.vl.json +++ b/examples/specs/interactive_query_widgets.vl.json @@ -4,7 +4,7 @@ "data": {"url": "data/cars.json"}, "transform": [{"calculate": "year(datum.Year)", "as": "Year"}], "layer": [{ - "selection": [{ + "params": [{ "name": "CylYr", "value": {"Cylinders": 4, "Year": 1977}, "select": {"type": "single", "fields": ["Cylinders", "Year"]}, diff --git a/examples/specs/interactive_seattle_weather.vl.json b/examples/specs/interactive_seattle_weather.vl.json index 91099aa102..88f60640ed 100644 --- a/examples/specs/interactive_seattle_weather.vl.json +++ b/examples/specs/interactive_seattle_weather.vl.json @@ -42,7 +42,7 @@ "width": 600, "height": 300, "mark": "point", - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["x"]} }], @@ -66,7 +66,7 @@ }, "width": 600, "mark": "bar", - "selection": [{ + "params": [{ "name": "click", "select": {"type": "multi", "encodings": ["color"]} }], diff --git a/examples/specs/interactive_splom.vl.json b/examples/specs/interactive_splom.vl.json index 9cdc370f6a..3ae36ef823 100644 --- a/examples/specs/interactive_splom.vl.json +++ b/examples/specs/interactive_splom.vl.json @@ -7,7 +7,7 @@ "spec": { "data": {"url": "data/cars.json"}, "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { diff --git a/examples/specs/interactive_stocks_nearest_index.vl.json b/examples/specs/interactive_stocks_nearest_index.vl.json index 6f0b8bc761..95de5c5a7d 100644 --- a/examples/specs/interactive_stocks_nearest_index.vl.json +++ b/examples/specs/interactive_stocks_nearest_index.vl.json @@ -15,7 +15,7 @@ } }, { - "selection": [{ + "params": [{ "name": "index", "select": { "type": "single", diff --git a/examples/specs/isotype_grid.vl.json b/examples/specs/isotype_grid.vl.json index 18062c3f82..0fb6bbca6d 100644 --- a/examples/specs/isotype_grid.vl.json +++ b/examples/specs/isotype_grid.vl.json @@ -124,5 +124,5 @@ }, "size": {"value": 90} }, - "selection": [{"name": "highlight", "select": "interval"}] + "params": [{"name": "highlight", "select": "interval"}] } diff --git a/examples/specs/normalized/airport_connections_normalized.vl.json b/examples/specs/normalized/airport_connections_normalized.vl.json index 674a34b5a7..a1b66780a9 100644 --- a/examples/specs/normalized/airport_connections_normalized.vl.json +++ b/examples/specs/normalized/airport_connections_normalized.vl.json @@ -61,7 +61,7 @@ }, {"filter": "datum.state !== 'PR' && datum.state !== 'VI'"} ], - "selection": [ + "params": [ { "name": "org", "select": { @@ -90,4 +90,4 @@ "width": 900, "height": 500, "config": {"view": {"stroke": null}} -} \ No newline at end of file +} diff --git a/examples/specs/normalized/concat_hover_filter_normalized.vl.json b/examples/specs/normalized/concat_hover_filter_normalized.vl.json index 6ba2aa4326..1ce214b31e 100644 --- a/examples/specs/normalized/concat_hover_filter_normalized.vl.json +++ b/examples/specs/normalized/concat_hover_filter_normalized.vl.json @@ -6,7 +6,7 @@ { "layer": [ { - "selection": [ + "params": [ { "name": "hover", "select": {"type": "single", "on": "mouseover", "empty": "none"} @@ -31,7 +31,7 @@ { "layer": [ { - "selection": [ + "params": [ { "name": "hover", "select": {"type": "single", "on": "mouseover", "empty": "none"} @@ -54,4 +54,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_area_brush_normalized.vl.json b/examples/specs/normalized/interactive_area_brush_normalized.vl.json index 163d38f1ef..f5f5460f97 100644 --- a/examples/specs/normalized/interactive_area_brush_normalized.vl.json +++ b/examples/specs/normalized/interactive_area_brush_normalized.vl.json @@ -3,9 +3,7 @@ "data": {"url": "data/unemployment-across-industries.json"}, "layer": [ { - "selection": [ - {"name": "brush", "select": {"type": "interval", "encodings": ["x"]}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "encodings": ["x"]}}], "mark": "area", "encoding": { "x": {"timeUnit": "yearmonth", "field": "date"}, @@ -21,4 +19,4 @@ } } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_global_development_normalized.vl.json b/examples/specs/normalized/interactive_global_development_normalized.vl.json index b0bb23a440..e2a43882ea 100644 --- a/examples/specs/normalized/interactive_global_development_normalized.vl.json +++ b/examples/specs/normalized/interactive_global_development_normalized.vl.json @@ -6,10 +6,7 @@ "height": 500, "layer": [ { - "transform": [ - {"filter": {"field": "country", "equal": "Afghanistan"}}, - {"filter": {"selection": "year"}} - ], + "transform": [{"filter": {"field": "country", "equal": "Afghanistan"}}, {"filter": {"selection": "year"}}], "mark": { "type": "text", "fontSize": 100, @@ -74,7 +71,7 @@ } }, { - "selection": [ + "params": [ { "name": "year", "value": {"year": 1955}, @@ -127,10 +124,7 @@ "transform": [ { "filter": { - "and": [ - {"selection": "year"}, - {"or": [{"selection": "clicked"}, {"selection": "hovered"}]} - ] + "and": [{"selection": "year"}, {"or": [{"selection": "clicked"}, {"selection": "hovered"}]}] } } ], @@ -158,10 +152,7 @@ } }, { - "transform": [ - {"filter": {"selection": "hovered"}}, - {"filter": {"not": {"selection": "year"}}} - ], + "transform": [{"filter": {"selection": "hovered"}}, {"filter": {"not": {"selection": "year"}}}], "layer": [ { "mark": { @@ -208,4 +199,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_index_chart_normalized.vl.json b/examples/specs/normalized/interactive_index_chart_normalized.vl.json index 04ab1d243c..f6fb2bce8a 100644 --- a/examples/specs/normalized/interactive_index_chart_normalized.vl.json +++ b/examples/specs/normalized/interactive_index_chart_normalized.vl.json @@ -5,7 +5,7 @@ "height": 300, "layer": [ { - "selection": [ + "params": [ { "name": "index", "value": {"x": {"year": 2005, "month": 1, "date": 1}}, @@ -64,4 +64,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_layered_crossfilter_discrete_normalized.vl.json b/examples/specs/normalized/interactive_layered_crossfilter_discrete_normalized.vl.json index d1905ca2ee..4b49f036c6 100644 --- a/examples/specs/normalized/interactive_layered_crossfilter_discrete_normalized.vl.json +++ b/examples/specs/normalized/interactive_layered_crossfilter_discrete_normalized.vl.json @@ -11,9 +11,7 @@ { "layer": [ { - "selection": [ - {"name": "brush", "select": {"type": "multi", "encodings": ["x"]}} - ], + "params": [{"name": "brush", "select": {"type": "multi", "encodings": ["x"]}}], "mark": "bar", "encoding": { "x": {"field": "distance", "bin": {"maxbins": 20}}, @@ -35,9 +33,7 @@ { "layer": [ { - "selection": [ - {"name": "brush", "select": {"type": "multi", "encodings": ["x"]}} - ], + "params": [{"name": "brush", "select": {"type": "multi", "encodings": ["x"]}}], "mark": "bar", "encoding": { "x": {"field": "delay", "bin": {"maxbins": 20}}, @@ -59,9 +55,7 @@ { "layer": [ { - "selection": [ - {"name": "brush", "select": {"type": "multi", "encodings": ["x"]}} - ], + "params": [{"name": "brush", "select": {"type": "multi", "encodings": ["x"]}}], "mark": "bar", "encoding": { "x": {"field": "time", "bin": {"maxbins": 20}}, @@ -81,4 +75,4 @@ "name": "child__column_time" } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_layered_crossfilter_normalized.vl.json b/examples/specs/normalized/interactive_layered_crossfilter_normalized.vl.json index a2d9c7b060..33ab0eefbc 100644 --- a/examples/specs/normalized/interactive_layered_crossfilter_normalized.vl.json +++ b/examples/specs/normalized/interactive_layered_crossfilter_normalized.vl.json @@ -11,7 +11,7 @@ { "layer": [ { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "encodings": ["x"]} @@ -38,7 +38,7 @@ { "layer": [ { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "encodings": ["x"]} @@ -65,7 +65,7 @@ { "layer": [ { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "encodings": ["x"]} @@ -90,4 +90,4 @@ "name": "child__column_time" } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_line_hover_normalized.vl.json b/examples/specs/normalized/interactive_line_hover_normalized.vl.json index f9610351ad..ba744163f4 100644 --- a/examples/specs/normalized/interactive_line_hover_normalized.vl.json +++ b/examples/specs/normalized/interactive_line_hover_normalized.vl.json @@ -6,7 +6,7 @@ "layer": [ { "description": "transparent layer to make it easier to trigger selection", - "selection": [ + "params": [ { "name": "hover", "value": {"symbol": "AAPL"}, @@ -124,4 +124,4 @@ } ], "config": {"view": {"stroke": null}} -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_multi_line_label_normalized.vl.json b/examples/specs/normalized/interactive_multi_line_label_normalized.vl.json index 548841aa2c..819df2a3a1 100644 --- a/examples/specs/normalized/interactive_multi_line_label_normalized.vl.json +++ b/examples/specs/normalized/interactive_multi_line_label_normalized.vl.json @@ -15,7 +15,7 @@ } }, { - "selection": [ + "params": [ { "name": "label", "select": { @@ -80,4 +80,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_multi_line_pivot_tooltip_normalized.vl.json b/examples/specs/normalized/interactive_multi_line_pivot_tooltip_normalized.vl.json index 6041773c42..4daf085ba1 100644 --- a/examples/specs/normalized/interactive_multi_line_pivot_tooltip_normalized.vl.json +++ b/examples/specs/normalized/interactive_multi_line_pivot_tooltip_normalized.vl.json @@ -42,7 +42,7 @@ {"field": "MSFT", "type": "quantitative"} ] }, - "selection": [ + "params": [ { "name": "hover", "select": { @@ -57,4 +57,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_multi_line_tooltip_normalized.vl.json b/examples/specs/normalized/interactive_multi_line_tooltip_normalized.vl.json index a0d05b478c..f41cc84779 100644 --- a/examples/specs/normalized/interactive_multi_line_tooltip_normalized.vl.json +++ b/examples/specs/normalized/interactive_multi_line_tooltip_normalized.vl.json @@ -28,7 +28,7 @@ }, { "mark": "rule", - "selection": [ + "params": [ { "name": "hover", "select": {"type": "single", "on": "mouseover", "empty": "none"} @@ -48,4 +48,4 @@ } ], "config": {"axisY": {"minExtent": 30}} -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_panzoom_splom_normalized.vl.json b/examples/specs/normalized/interactive_panzoom_splom_normalized.vl.json index 162e20bc01..bb92bb45b6 100644 --- a/examples/specs/normalized/interactive_panzoom_splom_normalized.vl.json +++ b/examples/specs/normalized/interactive_panzoom_splom_normalized.vl.json @@ -5,7 +5,7 @@ "columns": 3, "concat": [ { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -19,7 +19,7 @@ "name": "child__row_Horsepowercolumn_Miles_per_Gallon" }, { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -33,7 +33,7 @@ "name": "child__row_Horsepowercolumn_Acceleration" }, { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -47,7 +47,7 @@ "name": "child__row_Horsepowercolumn_Horsepower" }, { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -61,7 +61,7 @@ "name": "child__row_Accelerationcolumn_Miles_per_Gallon" }, { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -75,7 +75,7 @@ "name": "child__row_Accelerationcolumn_Acceleration" }, { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -89,7 +89,7 @@ "name": "child__row_Accelerationcolumn_Horsepower" }, { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -103,7 +103,7 @@ "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon" }, { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -117,7 +117,7 @@ "name": "child__row_Miles_per_Galloncolumn_Acceleration" }, { - "selection": [{"name": "grid", "select": "interval", "bind": "scales"}], + "params": [{"name": "grid", "select": "interval", "bind": "scales"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -131,4 +131,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_splom_normalized.vl.json b/examples/specs/normalized/interactive_splom_normalized.vl.json index 76b2960733..acb845550c 100644 --- a/examples/specs/normalized/interactive_splom_normalized.vl.json +++ b/examples/specs/normalized/interactive_splom_normalized.vl.json @@ -6,7 +6,7 @@ "concat": [ { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -48,7 +48,7 @@ }, { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -90,7 +90,7 @@ }, { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -132,7 +132,7 @@ }, { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -174,7 +174,7 @@ }, { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -216,7 +216,7 @@ }, { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -258,7 +258,7 @@ }, { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -300,7 +300,7 @@ }, { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -342,7 +342,7 @@ }, { "mark": "point", - "selection": [ + "params": [ { "name": "brush", "select": { @@ -383,4 +383,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/interactive_stocks_nearest_index_normalized.vl.json b/examples/specs/normalized/interactive_stocks_nearest_index_normalized.vl.json index 236caf96c8..3af85e70d6 100644 --- a/examples/specs/normalized/interactive_stocks_nearest_index_normalized.vl.json +++ b/examples/specs/normalized/interactive_stocks_nearest_index_normalized.vl.json @@ -13,7 +13,7 @@ } }, { - "selection": [ + "params": [ { "name": "index", "select": { @@ -32,16 +32,12 @@ } }, { - "transform": [ - {"filter": {"and": ["index.date", {"selection": "index"}]}} - ], + "transform": [{"filter": {"and": ["index.date", {"selection": "index"}]}}], "mark": "rule", "encoding": {"x": {"field": "date", "type": "temporal"}} }, { - "transform": [ - {"filter": {"and": ["index.date", {"selection": "index"}]}} - ], + "transform": [{"filter": {"and": ["index.date", {"selection": "index"}]}}], "mark": "text", "encoding": { "x": {"field": "date", "type": "temporal"}, @@ -51,4 +47,4 @@ } ], "config": {"text": {"align": "right", "dx": -5, "dy": 5}} -} \ No newline at end of file +} diff --git a/examples/specs/normalized/selection_resolution_global_normalized.vl.json b/examples/specs/normalized/selection_resolution_global_normalized.vl.json index e3873d528c..cd9c104024 100644 --- a/examples/specs/normalized/selection_resolution_global_normalized.vl.json +++ b/examples/specs/normalized/selection_resolution_global_normalized.vl.json @@ -5,9 +5,7 @@ "columns": 3, "concat": [ { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -24,9 +22,7 @@ "name": "child__row_Horsepowercolumn_Miles_per_Gallon" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -43,9 +39,7 @@ "name": "child__row_Horsepowercolumn_Acceleration" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -62,9 +56,7 @@ "name": "child__row_Horsepowercolumn_Horsepower" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -81,9 +73,7 @@ "name": "child__row_Accelerationcolumn_Miles_per_Gallon" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -100,9 +90,7 @@ "name": "child__row_Accelerationcolumn_Acceleration" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -119,9 +107,7 @@ "name": "child__row_Accelerationcolumn_Horsepower" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -138,9 +124,7 @@ "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -157,9 +141,7 @@ "name": "child__row_Miles_per_Galloncolumn_Acceleration" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "global"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -176,4 +158,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/selection_resolution_intersect_normalized.vl.json b/examples/specs/normalized/selection_resolution_intersect_normalized.vl.json index bbbcf44182..cba4a36dc5 100644 --- a/examples/specs/normalized/selection_resolution_intersect_normalized.vl.json +++ b/examples/specs/normalized/selection_resolution_intersect_normalized.vl.json @@ -5,7 +5,7 @@ "columns": 3, "concat": [ { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -27,7 +27,7 @@ "name": "child__row_Horsepowercolumn_Miles_per_Gallon" }, { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -49,7 +49,7 @@ "name": "child__row_Horsepowercolumn_Acceleration" }, { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -71,7 +71,7 @@ "name": "child__row_Horsepowercolumn_Horsepower" }, { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -93,7 +93,7 @@ "name": "child__row_Accelerationcolumn_Miles_per_Gallon" }, { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -115,7 +115,7 @@ "name": "child__row_Accelerationcolumn_Acceleration" }, { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -137,7 +137,7 @@ "name": "child__row_Accelerationcolumn_Horsepower" }, { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -159,7 +159,7 @@ "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon" }, { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -181,7 +181,7 @@ "name": "child__row_Miles_per_Galloncolumn_Acceleration" }, { - "selection": [ + "params": [ { "name": "brush", "select": {"type": "interval", "resolve": "intersect"} @@ -203,4 +203,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/selection_resolution_union_normalized.vl.json b/examples/specs/normalized/selection_resolution_union_normalized.vl.json index 4dcc85a354..9c2b0e4045 100644 --- a/examples/specs/normalized/selection_resolution_union_normalized.vl.json +++ b/examples/specs/normalized/selection_resolution_union_normalized.vl.json @@ -5,9 +5,7 @@ "columns": 3, "concat": [ { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -24,9 +22,7 @@ "name": "child__row_Horsepowercolumn_Miles_per_Gallon" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -43,9 +39,7 @@ "name": "child__row_Horsepowercolumn_Acceleration" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -62,9 +56,7 @@ "name": "child__row_Horsepowercolumn_Horsepower" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -81,9 +73,7 @@ "name": "child__row_Accelerationcolumn_Miles_per_Gallon" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -100,9 +90,7 @@ "name": "child__row_Accelerationcolumn_Acceleration" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -119,9 +107,7 @@ "name": "child__row_Accelerationcolumn_Horsepower" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -138,9 +124,7 @@ "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -157,9 +141,7 @@ "name": "child__row_Miles_per_Galloncolumn_Acceleration" }, { - "selection": [ - {"name": "brush", "select": {"type": "interval", "resolve": "union"}} - ], + "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -176,4 +158,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} \ No newline at end of file +} diff --git a/examples/specs/normalized/trellis_selections_normalized.vl.json b/examples/specs/normalized/trellis_selections_normalized.vl.json index 4680289fe6..35fe6ff537 100644 --- a/examples/specs/normalized/trellis_selections_normalized.vl.json +++ b/examples/specs/normalized/trellis_selections_normalized.vl.json @@ -15,7 +15,7 @@ }, "opacity": {"value": 1} }, - "selection": [ + "params": [ { "name": "brush", "select": { @@ -48,4 +48,4 @@ } ] } -} \ No newline at end of file +} diff --git a/examples/specs/selection_bind_cylyr.vl.json b/examples/specs/selection_bind_cylyr.vl.json index 2c4341172b..fbd712399d 100644 --- a/examples/specs/selection_bind_cylyr.vl.json +++ b/examples/specs/selection_bind_cylyr.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, "transform": [{"calculate": "year(datum.Year)", "as": "Year"}], - "selection": [{ + "params": [{ "name": "CylYr", "select": {"type": "single", "fields": ["Cylinders", "Year"]}, "bind": { diff --git a/examples/specs/selection_bind_origin.vl.json b/examples/specs/selection_bind_origin.vl.json index 77d6c0cd6b..865f8673da 100644 --- a/examples/specs/selection_bind_origin.vl.json +++ b/examples/specs/selection_bind_origin.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "org", "select": {"type": "single", "fields": ["Origin"]}, "bind": {"input": "select", "options": [null, "Europe", "Japan", "USA"]} diff --git a/examples/specs/selection_brush_timeunit.vl.json b/examples/specs/selection_brush_timeunit.vl.json index 8c879bec09..b7b22d629d 100644 --- a/examples/specs/selection_brush_timeunit.vl.json +++ b/examples/specs/selection_brush_timeunit.vl.json @@ -11,7 +11,7 @@ }, "hconcat": [{ "mark": "point", - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["x"]} }], diff --git a/examples/specs/selection_clear_brush.vl.json b/examples/specs/selection_clear_brush.vl.json index b0465a4df3..1fd078b24c 100644 --- a/examples/specs/selection_clear_brush.vl.json +++ b/examples/specs/selection_clear_brush.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "brush", "value": {"x": [55, 160], "y": [13, 37]}, "select": {"type": "interval", "clear": "mouseup"} diff --git a/examples/specs/selection_composition_and.vl.json b/examples/specs/selection_composition_and.vl.json index 15ac8dd52a..769529973c 100644 --- a/examples/specs/selection_composition_and.vl.json +++ b/examples/specs/selection_composition_and.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [ + "params": [ { "name": "alex", "select": { diff --git a/examples/specs/selection_composition_or.vl.json b/examples/specs/selection_composition_or.vl.json index 9d78c755dc..cd7fec5e2b 100644 --- a/examples/specs/selection_composition_or.vl.json +++ b/examples/specs/selection_composition_or.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [ + "params": [ { "name": "alex", "select": { diff --git a/examples/specs/selection_concat.vl.json b/examples/specs/selection_concat.vl.json index 20d4183dbb..52781619be 100644 --- a/examples/specs/selection_concat.vl.json +++ b/examples/specs/selection_concat.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, "vconcat": [{ - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "resolve": "global"} }], @@ -13,7 +13,7 @@ } }, { "mark": "point", - "selection": [{ + "params": [{ "name": "grid", "select": "interval", "bind": "scales" diff --git a/examples/specs/selection_filter.vl.json b/examples/specs/selection_filter.vl.json index 051205a0b0..255b59592f 100644 --- a/examples/specs/selection_filter.vl.json +++ b/examples/specs/selection_filter.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, "vconcat": [{ - "selection": [{"name": "brush", "select": "interval"}], + "params": [{"name": "brush", "select": "interval"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, diff --git a/examples/specs/selection_filter_composition.vl.json b/examples/specs/selection_filter_composition.vl.json index b654681554..80046afd38 100644 --- a/examples/specs/selection_filter_composition.vl.json +++ b/examples/specs/selection_filter_composition.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, "vconcat": [{ - "selection": [{"name": "brush", "select": "interval"}], + "params": [{"name": "brush", "select": "interval"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, diff --git a/examples/specs/selection_heatmap.vl.json b/examples/specs/selection_heatmap.vl.json index 8897a6b341..1369850779 100644 --- a/examples/specs/selection_heatmap.vl.json +++ b/examples/specs/selection_heatmap.vl.json @@ -13,7 +13,7 @@ {"actual": "C", "predicted": "C", "count": 9} ] }, - "selection": [{"name": "highlight", "select": "single"}], + "params": [{"name": "highlight", "select": "single"}], "mark": {"type": "rect", "strokeWidth": 2}, "encoding": { "y": { diff --git a/examples/specs/selection_insert.vl.json b/examples/specs/selection_insert.vl.json index 1f2986b07c..a2792b4dba 100644 --- a/examples/specs/selection_insert.vl.json +++ b/examples/specs/selection_insert.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "paintbrush", "select": {"type": "multi", "toggle": false} }], diff --git a/examples/specs/selection_interval_mark_style.vl.json b/examples/specs/selection_interval_mark_style.vl.json index 4e8f6954aa..86feb99e96 100644 --- a/examples/specs/selection_interval_mark_style.vl.json +++ b/examples/specs/selection_interval_mark_style.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [ + "params": [ { "name": "alex", "select": { diff --git a/examples/specs/selection_layer.json b/examples/specs/selection_layer.json index 209355a360..496c09c559 100644 --- a/examples/specs/selection_layer.json +++ b/examples/specs/selection_layer.json @@ -4,7 +4,7 @@ "data": {"url": "data/cars.json"}, "layer": [ { - "selection": [ + "params": [ { "name": "grid", "select": { @@ -33,7 +33,7 @@ }, { "mark": "square", - "selection": [ + "params": [ { "name": "brush", "select": { diff --git a/examples/specs/selection_layer_bar_month.vl.json b/examples/specs/selection_layer_bar_month.vl.json index 88622eb61d..89b4fb5fca 100644 --- a/examples/specs/selection_layer_bar_month.vl.json +++ b/examples/specs/selection_layer_bar_month.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/seattle-weather.csv"}, "layer": [{ - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["x"]} }], diff --git a/examples/specs/selection_multi_condition.vl.json b/examples/specs/selection_multi_condition.vl.json index 0220b8fab1..69487fe458 100644 --- a/examples/specs/selection_multi_condition.vl.json +++ b/examples/specs/selection_multi_condition.vl.json @@ -2,7 +2,7 @@ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "description": "Drag out a rectangular brush to highlight points.", "data": {"url": "data/cars.json"}, - "selection": [ + "params": [ {"name": "brush", "select": "interval"}, { "name": "hoverbrush", diff --git a/examples/specs/selection_project_binned_interval.vl.json b/examples/specs/selection_project_binned_interval.vl.json index 31b7156efc..3c8bac0db8 100644 --- a/examples/specs/selection_project_binned_interval.vl.json +++ b/examples/specs/selection_project_binned_interval.vl.json @@ -3,7 +3,7 @@ "data": {"url": "data/cars.json"}, "layer": [ { - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "encodings": ["x"]} }], diff --git a/examples/specs/selection_project_interval.vl.json b/examples/specs/selection_project_interval.vl.json index 51c1af55f5..317112caaa 100644 --- a/examples/specs/selection_project_interval.vl.json +++ b/examples/specs/selection_project_interval.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "pts", "select": "interval"}], + "params": [{"name": "pts", "select": "interval"}], "mark": "rect", "encoding": { "y": {"field": "Origin", "type": "ordinal"}, diff --git a/examples/specs/selection_project_interval_x.vl.json b/examples/specs/selection_project_interval_x.vl.json index 971c30e0a5..c5db63975d 100644 --- a/examples/specs/selection_project_interval_x.vl.json +++ b/examples/specs/selection_project_interval_x.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "interval", "encodings": ["x"]} }], diff --git a/examples/specs/selection_project_interval_x_y.vl.json b/examples/specs/selection_project_interval_x_y.vl.json index b999859389..13fe28e368 100644 --- a/examples/specs/selection_project_interval_x_y.vl.json +++ b/examples/specs/selection_project_interval_x_y.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "interval", "encodings": ["x", "y"]} }], diff --git a/examples/specs/selection_project_interval_y.vl.json b/examples/specs/selection_project_interval_y.vl.json index 18242aa6be..d14cf084d8 100644 --- a/examples/specs/selection_project_interval_y.vl.json +++ b/examples/specs/selection_project_interval_y.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "interval", "encodings": ["y"]} }], diff --git a/examples/specs/selection_project_multi.vl.json b/examples/specs/selection_project_multi.vl.json index 1d6ff75b16..bc84a432ec 100644 --- a/examples/specs/selection_project_multi.vl.json +++ b/examples/specs/selection_project_multi.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "pts", "select": "multi"}], + "params": [{"name": "pts", "select": "multi"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, diff --git a/examples/specs/selection_project_multi_cylinders.vl.json b/examples/specs/selection_project_multi_cylinders.vl.json index 5ab9b9bfdb..5eca94fb4f 100644 --- a/examples/specs/selection_project_multi_cylinders.vl.json +++ b/examples/specs/selection_project_multi_cylinders.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "multi", "fields": ["Cylinders"]} }], diff --git a/examples/specs/selection_project_multi_cylinders_origin.vl.json b/examples/specs/selection_project_multi_cylinders_origin.vl.json index 374bd90c31..8586d97a3f 100644 --- a/examples/specs/selection_project_multi_cylinders_origin.vl.json +++ b/examples/specs/selection_project_multi_cylinders_origin.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "multi", "fields": ["Cylinders", "Origin"]} }], diff --git a/examples/specs/selection_project_multi_origin.vl.json b/examples/specs/selection_project_multi_origin.vl.json index 4a6042518e..8018233ed4 100644 --- a/examples/specs/selection_project_multi_origin.vl.json +++ b/examples/specs/selection_project_multi_origin.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "multi", "fields": ["Origin"]} }], diff --git a/examples/specs/selection_project_single.vl.json b/examples/specs/selection_project_single.vl.json index f62a3c8231..b708a91024 100644 --- a/examples/specs/selection_project_single.vl.json +++ b/examples/specs/selection_project_single.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "pts", "select": "single"}], + "params": [{"name": "pts", "select": "single"}], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, diff --git a/examples/specs/selection_project_single_cylinders.vl.json b/examples/specs/selection_project_single_cylinders.vl.json index fa73dc3311..221fe8003c 100644 --- a/examples/specs/selection_project_single_cylinders.vl.json +++ b/examples/specs/selection_project_single_cylinders.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "single", "fields": ["Cylinders"]} }], diff --git a/examples/specs/selection_project_single_cylinders_origin.vl.json b/examples/specs/selection_project_single_cylinders_origin.vl.json index 66bf7eadbc..8079a38946 100644 --- a/examples/specs/selection_project_single_cylinders_origin.vl.json +++ b/examples/specs/selection_project_single_cylinders_origin.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "single", "fields": ["Cylinders", "Origin"]} }], diff --git a/examples/specs/selection_project_single_origin.vl.json b/examples/specs/selection_project_single_origin.vl.json index 1821177a11..20bcc566ac 100644 --- a/examples/specs/selection_project_single_origin.vl.json +++ b/examples/specs/selection_project_single_origin.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "single", "fields": ["Origin"]} }], diff --git a/examples/specs/selection_resolution_global.vl.json b/examples/specs/selection_resolution_global.vl.json index ff818b1e82..32c7668467 100644 --- a/examples/specs/selection_resolution_global.vl.json +++ b/examples/specs/selection_resolution_global.vl.json @@ -6,7 +6,7 @@ "column": ["Miles_per_Gallon", "Acceleration", "Horsepower"] }, "spec": { - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "resolve": "global"} }], diff --git a/examples/specs/selection_resolution_intersect.vl.json b/examples/specs/selection_resolution_intersect.vl.json index 7769ddd0c0..c9b0348d6b 100644 --- a/examples/specs/selection_resolution_intersect.vl.json +++ b/examples/specs/selection_resolution_intersect.vl.json @@ -6,7 +6,7 @@ "column": ["Miles_per_Gallon", "Acceleration", "Horsepower"] }, "spec": { - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "resolve": "intersect"} }], diff --git a/examples/specs/selection_resolution_union.vl.json b/examples/specs/selection_resolution_union.vl.json index 06780cfdeb..56714120db 100644 --- a/examples/specs/selection_resolution_union.vl.json +++ b/examples/specs/selection_resolution_union.vl.json @@ -6,7 +6,7 @@ "column": ["Miles_per_Gallon", "Acceleration", "Horsepower"] }, "spec": { - "selection": [{ + "params": [{ "name": "brush", "select": {"type": "interval", "resolve": "union"} }], diff --git a/examples/specs/selection_toggle_altKey.vl.json b/examples/specs/selection_toggle_altKey.vl.json index c0e8337880..94c9e77fcf 100644 --- a/examples/specs/selection_toggle_altKey.vl.json +++ b/examples/specs/selection_toggle_altKey.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "paintbrush", "select": { "type": "multi", diff --git a/examples/specs/selection_toggle_altKey_shiftKey.vl.json b/examples/specs/selection_toggle_altKey_shiftKey.vl.json index 62a411ca3f..56f17d86ae 100644 --- a/examples/specs/selection_toggle_altKey_shiftKey.vl.json +++ b/examples/specs/selection_toggle_altKey_shiftKey.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "paintbrush", "select": { "type": "multi", diff --git a/examples/specs/selection_toggle_shiftKey.vl.json b/examples/specs/selection_toggle_shiftKey.vl.json index aa7bbc92c6..50d7ed949b 100644 --- a/examples/specs/selection_toggle_shiftKey.vl.json +++ b/examples/specs/selection_toggle_shiftKey.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "paintbrush", "select": "multi"}], + "params": [{"name": "paintbrush", "select": "multi"}], "mark": "circle", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, diff --git a/examples/specs/selection_translate_brush_drag.vl.json b/examples/specs/selection_translate_brush_drag.vl.json index 13fbf20780..965ffd3ac0 100644 --- a/examples/specs/selection_translate_brush_drag.vl.json +++ b/examples/specs/selection_translate_brush_drag.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "brush", "select": "interval"}], + "params": [{"name": "brush", "select": "interval"}], "mark": {"type": "circle", "clip": true}, "encoding": { "x": { diff --git a/examples/specs/selection_translate_brush_shift-drag.vl.json b/examples/specs/selection_translate_brush_shift-drag.vl.json index 8a7bba3a65..c441a4a590 100644 --- a/examples/specs/selection_translate_brush_shift-drag.vl.json +++ b/examples/specs/selection_translate_brush_shift-drag.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "brush", "select": { "type": "interval", diff --git a/examples/specs/selection_translate_scatterplot_drag.vl.json b/examples/specs/selection_translate_scatterplot_drag.vl.json index 2b4f65d145..18a88e88bf 100644 --- a/examples/specs/selection_translate_scatterplot_drag.vl.json +++ b/examples/specs/selection_translate_scatterplot_drag.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "grid", "select": "interval", "bind": "scales" diff --git a/examples/specs/selection_translate_scatterplot_shift-drag.vl.json b/examples/specs/selection_translate_scatterplot_shift-drag.vl.json index a6f988ff0c..a11ceb47f3 100644 --- a/examples/specs/selection_translate_scatterplot_shift-drag.vl.json +++ b/examples/specs/selection_translate_scatterplot_shift-drag.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "grid", "select": { "type": "interval", diff --git a/examples/specs/selection_type_interval.vl.json b/examples/specs/selection_type_interval.vl.json index c017c4d195..3dd45411d3 100644 --- a/examples/specs/selection_type_interval.vl.json +++ b/examples/specs/selection_type_interval.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "pts", "select": "interval"}], + "params": [{"name": "pts", "select": "interval"}], "mark": "rect", "encoding": { "y": {"field": "Origin"}, diff --git a/examples/specs/selection_type_interval_invert.vl.json b/examples/specs/selection_type_interval_invert.vl.json index 73a874cbb1..bb11745487 100644 --- a/examples/specs/selection_type_interval_invert.vl.json +++ b/examples/specs/selection_type_interval_invert.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "pts", "select": "interval"}], + "params": [{"name": "pts", "select": "interval"}], "mark": "rect", "encoding": { "y": {"field": "Origin"}, diff --git a/examples/specs/selection_type_multi.vl.json b/examples/specs/selection_type_multi.vl.json index eda11b31eb..5d9fb88f37 100644 --- a/examples/specs/selection_type_multi.vl.json +++ b/examples/specs/selection_type_multi.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "pts", "select": "multi"}], + "params": [{"name": "pts", "select": "multi"}], "mark": "rect", "encoding": { "y": {"field": "Origin"}, diff --git a/examples/specs/selection_type_single.vl.json b/examples/specs/selection_type_single.vl.json index ec113a6962..d6f5046cc8 100644 --- a/examples/specs/selection_type_single.vl.json +++ b/examples/specs/selection_type_single.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "pts", "select": "single"}], + "params": [{"name": "pts", "select": "single"}], "mark": "rect", "encoding": { "y": {"field": "Origin"}, diff --git a/examples/specs/selection_type_single_dblclick.vl.json b/examples/specs/selection_type_single_dblclick.vl.json index b13f37f17e..20db13b53d 100644 --- a/examples/specs/selection_type_single_dblclick.vl.json +++ b/examples/specs/selection_type_single_dblclick.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "single", "on": "dblclick"} }], diff --git a/examples/specs/selection_type_single_mouseover.vl.json b/examples/specs/selection_type_single_mouseover.vl.json index e92efd6e81..57555b674a 100644 --- a/examples/specs/selection_type_single_mouseover.vl.json +++ b/examples/specs/selection_type_single_mouseover.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "single", "on": "mouseover"} }], diff --git a/examples/specs/selection_zoom_brush_shift-wheel.vl.json b/examples/specs/selection_zoom_brush_shift-wheel.vl.json index 05ddf3698f..e2bb673701 100644 --- a/examples/specs/selection_zoom_brush_shift-wheel.vl.json +++ b/examples/specs/selection_zoom_brush_shift-wheel.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "brush", "select": { "type": "interval", diff --git a/examples/specs/selection_zoom_brush_wheel.vl.json b/examples/specs/selection_zoom_brush_wheel.vl.json index 13fbf20780..965ffd3ac0 100644 --- a/examples/specs/selection_zoom_brush_wheel.vl.json +++ b/examples/specs/selection_zoom_brush_wheel.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{"name": "brush", "select": "interval"}], + "params": [{"name": "brush", "select": "interval"}], "mark": {"type": "circle", "clip": true}, "encoding": { "x": { diff --git a/examples/specs/selection_zoom_scatterplot_shift-wheel.vl.json b/examples/specs/selection_zoom_scatterplot_shift-wheel.vl.json index 19308c9e9e..1b93101f96 100644 --- a/examples/specs/selection_zoom_scatterplot_shift-wheel.vl.json +++ b/examples/specs/selection_zoom_scatterplot_shift-wheel.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "grid", "select": { "type": "interval", diff --git a/examples/specs/selection_zoom_scatterplot_wheel.vl.json b/examples/specs/selection_zoom_scatterplot_wheel.vl.json index 2b4f65d145..18a88e88bf 100644 --- a/examples/specs/selection_zoom_scatterplot_wheel.vl.json +++ b/examples/specs/selection_zoom_scatterplot_wheel.vl.json @@ -1,7 +1,7 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/cars.json"}, - "selection": [{ + "params": [{ "name": "grid", "select": "interval", "bind": "scales" diff --git a/examples/specs/trellis_selections.vl.json b/examples/specs/trellis_selections.vl.json index 96655fbfc9..3673317b8c 100644 --- a/examples/specs/trellis_selections.vl.json +++ b/examples/specs/trellis_selections.vl.json @@ -3,7 +3,7 @@ "description": "Anscombe's Quartet", "data": {"url": "data/anscombe.json"}, "mark": "circle", - "selection": [ + "params": [ { "name": "brush", "select": { diff --git a/examples/specs/vconcat_flatten.vl.json b/examples/specs/vconcat_flatten.vl.json index a16aabccab..6e34075128 100644 --- a/examples/specs/vconcat_flatten.vl.json +++ b/examples/specs/vconcat_flatten.vl.json @@ -30,7 +30,7 @@ "title": "Sky position", "transform": [{"aggregate": [], "groupby": ["ra", "dec", "id"]}], "mark": "circle", - "selection": [{ + "params": [{ "name": "pts", "select": {"type": "multi", "fields": ["id"], "empty": "all"} }], diff --git a/src/compile/unit.ts b/src/compile/unit.ts index 5b8343a07b..1778e8867f 100644 --- a/src/compile/unit.ts +++ b/src/compile/unit.ts @@ -121,7 +121,7 @@ export class UnitModel extends ModelWithField { this.specifiedProjection = spec.projection; // Selections will be initialized upon parse. - this.selection = spec.selection; + this.selection = (spec.params ?? []).filter(p => !!p.select); } public get hasProjection(): boolean { diff --git a/src/compositemark/boxplot.ts b/src/compositemark/boxplot.ts index 2a6e70a7fb..c3909ebfb4 100644 --- a/src/compositemark/boxplot.ts +++ b/src/compositemark/boxplot.ts @@ -87,11 +87,11 @@ export function normalizeBoxPlot( ...spec, encoding: normalizeEncoding(spec.encoding, config) }; - const {mark, encoding: _encoding, selection, projection: _p, ...outerSpec} = spec; + const {mark, encoding: _encoding, params, projection: _p, ...outerSpec} = spec; const markDef: BoxPlotDef = isMarkDef(mark) ? mark : {type: mark}; // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - if (selection) { + if (params) { log.warn(log.message.selectionNotSupported('boxplot')); } diff --git a/src/compositemark/errorbar.ts b/src/compositemark/errorbar.ts index 6ce87e0409..7829b0477b 100644 --- a/src/compositemark/errorbar.ts +++ b/src/compositemark/errorbar.ts @@ -343,11 +343,11 @@ export function errorBarParams< tooltipEncoding: ErrorEncoding; } { // TODO: use selection - const {mark, encoding, selection, projection: _p, ...outerSpec} = spec; + const {mark, encoding, params, projection: _p, ...outerSpec} = spec; const markDef: MD = isMarkDef(mark) ? mark : ({type: mark} as MD); // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support - if (selection) { + if (params) { log.warn(log.message.selectionNotSupported(compositeMark)); } diff --git a/src/normalize/core.ts b/src/normalize/core.ts index 4d9ffe077e..879b748420 100644 --- a/src/normalize/core.ts +++ b/src/normalize/core.ts @@ -232,17 +232,17 @@ export class CoreNormalizer extends SpecMapper, M> extends BaseSpec { /** * An array of interactive selections, such as discrete points and continuous intervals. */ - selection?: SelectionDef[]; + params?: SelectionDef[]; } /** diff --git a/test-runtime/util.ts b/test-runtime/util.ts index 8e8d6fa878..b600523e38 100644 --- a/test-runtime/util.ts +++ b/test-runtime/util.ts @@ -114,13 +114,13 @@ function base(iter: number, selDef: any, opts: any = {}): NormalizedUnitSpec | N const color = {field: 'c', type: 'nominal', ...opts.color}; const size = {value: 100, ...opts.size}; const {bind, ...select} = selDef; - const selection = [{name: 'sel', select, bind}]; + const params = [{name: 'sel', select, bind}]; const mark = 'circle'; if (iter % 2 === 0) { return { data, - selection, + params, mark, encoding: { x, @@ -137,7 +137,7 @@ function base(iter: number, selDef: any, opts: any = {}): NormalizedUnitSpec | N data, layer: [ { - selection, + params, mark, encoding: { x, diff --git a/test/compile/data/bin.test.ts b/test/compile/data/bin.test.ts index 142b8c92e5..4439ae8e12 100644 --- a/test/compile/data/bin.test.ts +++ b/test/compile/data/bin.test.ts @@ -35,7 +35,7 @@ function makeMovieExample(t: BinTransform) { function makeMovieExampleWithSelection(t: BinTransform) { return parseUnitModelWithScaleAndSelection({ data: {url: 'data/movies.json'}, - selection: [{name: 'foo', select: {type: 'interval'}}], + params: [{name: 'foo', select: {type: 'interval'}}], mark: 'circle', transform: [t], encoding: { @@ -109,7 +109,7 @@ describe('compile/data/bin', () => { it('should add bin transform and correctly apply bin for binned field with selection extent', () => { const model = parseUnitModelWithScaleAndSelection({ - selection: [{name: 'foo', select: {type: 'interval', fields: ['Acceleration']}}], + params: [{name: 'foo', select: {type: 'interval', fields: ['Acceleration']}}], mark: 'point', encoding: { x: { @@ -147,7 +147,7 @@ describe('compile/data/bin', () => { it('should add bin transform and correctly apply bin for binned field with selection with field extent', () => { const model = parseUnitModelWithScaleAndSelection({ - selection: [{name: 'foo', select: {type: 'interval', fields: ['Acceleration']}}], + params: [{name: 'foo', select: {type: 'interval', fields: ['Acceleration']}}], mark: 'point', encoding: { y: { diff --git a/test/compile/data/formatparse.test.ts b/test/compile/data/formatparse.test.ts index a83893f6ca..925cc616fa 100644 --- a/test/compile/data/formatparse.test.ts +++ b/test/compile/data/formatparse.test.ts @@ -190,7 +190,7 @@ describe('compile/data/formatparse', () => { it('should add flatten for nested fields in selection', () => { const model = parseUnitModel({ - selection: [{name: 'foo', select: {type: 'single', fields: ['foo.bar', 'foo.baz']}}], + params: [{name: 'foo', select: {type: 'single', fields: ['foo.bar', 'foo.baz']}}], mark: 'point', encoding: { x: {field: 'bar', type: 'quantitative'}, diff --git a/test/compile/mark/init.test.ts b/test/compile/mark/init.test.ts index 2f5321d638..e1fb8c7995 100644 --- a/test/compile/mark/init.test.ts +++ b/test/compile/mark/init.test.ts @@ -447,7 +447,7 @@ describe('compile/mark/init', () => { it('should return pointer cursor when href channel present', () => { const model = parseUnitModelWithScaleAndLayoutSize({ mark: 'bar', - selection: [{name: 'test', select: 'single'}], + params: [{name: 'test', select: 'single'}], encoding: { x: {field: 'a', type: 'ordinal'}, y: {field: 'b', type: 'quantitative'}, @@ -464,7 +464,7 @@ describe('compile/mark/init', () => { it('should return specified cursor when href channel present but cursor specified', () => { const model = parseUnitModelWithScaleAndLayoutSize({ mark: {type: 'bar', cursor: 'auto'}, - selection: [{name: 'test', select: 'single'}], + params: [{name: 'test', select: 'single'}], encoding: { x: {field: 'a', type: 'ordinal'}, y: {field: 'b', type: 'quantitative'}, diff --git a/test/compile/mark/mark.test.ts b/test/compile/mark/mark.test.ts index d8af4f1c7a..e0142c7db4 100644 --- a/test/compile/mark/mark.test.ts +++ b/test/compile/mark/mark.test.ts @@ -253,7 +253,7 @@ describe('Mark', () => { const model = parseConcatModel({ vconcat: [ { - selection: [{name: 'brush', select: 'interval'}], + params: [{name: 'brush', select: 'interval'}], mark: 'point', encoding: { x: {type: 'quantitative', field: 'foo'}, @@ -281,7 +281,7 @@ describe('Mark', () => { const model = parseConcatModel({ vconcat: [ { - selection: [{name: 'brush', select: {type: 'interval'}}], + params: [{name: 'brush', select: {type: 'interval'}}], mark: 'point', encoding: { x: {type: 'quantitative', field: 'foo'}, diff --git a/test/compile/mark/point.test.ts b/test/compile/mark/point.test.ts index 65aeb253e7..e41bd1d3c7 100644 --- a/test/compile/mark/point.test.ts +++ b/test/compile/mark/point.test.ts @@ -249,7 +249,7 @@ describe('Mark: Point', () => { ...pointXY({ color: {condition: {selection: 'test', field: 'yield', type: 'quantitative'}} }), - selection: [{name: 'test', select: 'single'}] + params: [{name: 'test', select: 'single'}] }); model.parseSelections(); const props = point.encodeEntry(model); diff --git a/test/compile/selection/facets.test.ts b/test/compile/selection/facets.test.ts index 99666bf4a0..335bcd258a 100644 --- a/test/compile/selection/facets.test.ts +++ b/test/compile/selection/facets.test.ts @@ -18,7 +18,7 @@ describe('Faceted Selections', () => { encoding: {y: {value: 10}} }, { - selection: [ + params: [ {name: 'one', select: 'single'}, {name: 'twp', select: 'multi'}, {name: 'three', select: 'interval'} diff --git a/test/compile/selection/identifier.test.ts b/test/compile/selection/identifier.test.ts index 750680bbfa..f9d8cffbbe 100644 --- a/test/compile/selection/identifier.test.ts +++ b/test/compile/selection/identifier.test.ts @@ -6,11 +6,11 @@ import {Mark} from '../../../src/mark'; import {SELECTION_ID} from '../../../src/selection'; import {parseConcatModel, parseUnitModelWithScaleAndSelection} from '../../util'; -function getVgData(selection: any, x?: any, y?: any, mark?: Mark, enc?: any, transform?: any) { +function getVgData(params: any, x?: any, y?: any, mark?: Mark, enc?: any, transform?: any) { const model = parseUnitModelWithScaleAndSelection({ data: {url: 'data/cars.json'}, transform, - selection, + params, mark: mark || 'circle', encoding: { x: {field: 'Horsepower', type: 'quantitative', ...x}, @@ -82,7 +82,7 @@ describe('compile/data/identifier', () => { data: {url: 'data/cars.json'}, hconcat: [ { - selection: [ + params: [ { name: 'pt', select: 'single' diff --git a/test/compile/selection/layers.test.ts b/test/compile/selection/layers.test.ts index 73e4467118..0eaee429bf 100644 --- a/test/compile/selection/layers.test.ts +++ b/test/compile/selection/layers.test.ts @@ -6,7 +6,7 @@ describe('Layered Selections', () => { const layers = parseLayerModel({ layer: [ { - selection: [ + params: [ { name: 'brush', select: 'interval' @@ -20,7 +20,7 @@ describe('Layered Selections', () => { } }, { - selection: [ + params: [ { name: 'brush', select: 'interval', diff --git a/test/compile/selection/parse.test.ts b/test/compile/selection/parse.test.ts index 45e65665d0..e1e0fc3474 100644 --- a/test/compile/selection/parse.test.ts +++ b/test/compile/selection/parse.test.ts @@ -334,7 +334,7 @@ describe('Selection', () => { data: {url: 'data/stocks.csv'}, layer: [ { - selection: [ + params: [ { name: 'index', value: {x: {year: 2005, month: 1, date: 1}}, diff --git a/test/compile/selection/scales.test.ts b/test/compile/selection/scales.test.ts index 1d6c42d06d..7b4708320f 100644 --- a/test/compile/selection/scales.test.ts +++ b/test/compile/selection/scales.test.ts @@ -15,7 +15,7 @@ describe('Selection + Scales', () => { vconcat: [ { mark: 'area', - selection: [ + params: [ {name: 'brush', select: {type: 'interval', encodings: ['x']}}, {name: 'brush2', select: {type: 'multi', fields: ['price'], resolve: 'intersect'}} ], @@ -25,7 +25,7 @@ describe('Selection + Scales', () => { } }, { - selection: [{name: 'brush3', select: {type: 'interval', fields: ['symbol']}}], + params: [{name: 'brush3', select: {type: 'interval', fields: ['symbol']}}], mark: 'area', encoding: { x: { @@ -106,7 +106,7 @@ describe('Selection + Scales', () => { }, { mark: 'area', - selection: [ + params: [ { name: 'brush', select: {type: 'interval', encodings: ['x']} @@ -129,7 +129,7 @@ describe('Selection + Scales', () => { it('should handle nested field references', () => { let model: Model = parseUnitModelWithScale({ - selection: [ + params: [ { name: 'grid', select: 'interval', @@ -163,7 +163,7 @@ describe('Selection + Scales', () => { vconcat: [ { mark: 'area', - selection: [ + params: [ { name: 'brush', select: {type: 'interval', encodings: ['x']} @@ -233,7 +233,7 @@ describe('Selection + Scales', () => { spec: { data: {url: 'data/cars.json'}, mark: 'point', - selection: [ + params: [ { name: 'grid', select: { @@ -260,7 +260,7 @@ describe('Selection + Scales', () => { x: {type: 'quantitative', field: 'Miles_per_Gallon'}, y: {type: 'quantitative', field: 'Weight_in_lbs'} }, - selection: [{name: 'selector001', select: 'interval', bind: 'scales'}] + params: [{name: 'selector001', select: 'interval', bind: 'scales'}] }, { mark: 'point', @@ -268,7 +268,7 @@ describe('Selection + Scales', () => { x: {type: 'quantitative', field: 'Acceleration'}, y: {type: 'quantitative', field: 'Horsepower'} }, - selection: [{name: 'selector001', select: {type: 'interval'}, bind: 'scales'}] + params: [{name: 'selector001', select: {type: 'interval'}, bind: 'scales'}] } ] }); @@ -332,7 +332,7 @@ describe('Selection + Scales', () => { log.wrap(localLogger => { let model = parseUnitModelWithScale({ data: {url: 'data/cars.json'}, - selection: [ + params: [ { name: 'grid', select: 'interval', @@ -349,7 +349,7 @@ describe('Selection + Scales', () => { model = parseUnitModelWithScale({ data: {url: 'data/cars.json'}, - selection: [ + params: [ { name: 'grid', select: {type: 'interval'}, diff --git a/test/compile/selection/timeunit.test.ts b/test/compile/selection/timeunit.test.ts index 83a333c39b..d595f66970 100644 --- a/test/compile/selection/timeunit.test.ts +++ b/test/compile/selection/timeunit.test.ts @@ -27,7 +27,7 @@ function getConcatModel(unit2: NormalizedUnitSpec, config?: Config) { hconcat: [ { mark: 'point', - selection: [ + params: [ { name: 'two', select: {type: 'single', encodings: ['x', 'y']} From 71e962d4f87fcb348b45d757b2b228c62fbe5de8 Mon Sep 17 00:00:00 2001 From: Arvind Satyanarayan Date: Thu, 1 Oct 2020 16:28:10 -0400 Subject: [PATCH 2/8] feat: define selections at the top-level spec --- src/normalize/base.ts | 2 + src/normalize/index.ts | 6 ++- src/normalize/toplevelselection.ts | 41 ++++++++++++++++ src/parameter.ts | 4 +- src/selection.ts | 12 +++++ src/spec/toplevel.ts | 3 +- test/normalize/toplevelselection.test.ts | 60 ++++++++++++++++++++++++ 7 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 src/normalize/toplevelselection.ts create mode 100644 test/normalize/toplevelselection.test.ts diff --git a/src/normalize/base.ts b/src/normalize/base.ts index ae29921b8c..8f3efdce24 100644 --- a/src/normalize/base.ts +++ b/src/normalize/base.ts @@ -3,6 +3,7 @@ import {FieldName} from '../channeldef'; import {Config} from '../config'; import {Encoding} from '../encoding'; import {Projection} from '../projection'; +import {TopLevelSelectionDef} from '../selection'; import {GenericSpec, NormalizedSpec} from '../spec'; import {GenericLayerSpec, NormalizedLayerSpec} from '../spec/layer'; import {GenericUnitSpec, NormalizedUnitSpec} from '../spec/unit'; @@ -41,4 +42,5 @@ export interface NormalizerParams { parentProjection?: Projection; repeater?: RepeaterValue; repeaterPrefix?: string; + selections?: TopLevelSelectionDef[]; } diff --git a/src/normalize/index.ts b/src/normalize/index.ts index f03cb0c49e..08f2f75d14 100644 --- a/src/normalize/index.ts +++ b/src/normalize/index.ts @@ -19,6 +19,7 @@ import {AutoSizeParams, AutosizeType, TopLevel} from '../spec/toplevel'; import {deepEqual} from '../util'; import {NormalizerParams} from './base'; import {CoreNormalizer} from './core'; +import {TopLevelSelectionsNormalizer} from './toplevelselection'; export function normalize( spec: TopLevelSpec & LayoutSizeMixins, @@ -40,15 +41,18 @@ export function normalize( } const normalizer = new CoreNormalizer(); +const selectionNormalizer = new TopLevelSelectionsNormalizer(); /** * Decompose extended unit specs into composition of pure unit specs. + * And push top-level selection definitions down to unit specs. */ function normalizeGenericSpec( spec: GenericSpec | FacetedUnitSpec | RepeatSpec, config: Config = {} ) { - return normalizer.map(spec, {config}); + const normParams = {config}; + return selectionNormalizer.map(normalizer.map(spec, normParams), normParams); } function _normalizeAutoSize(autosize: AutosizeType | AutoSizeParams) { diff --git a/src/normalize/toplevelselection.ts b/src/normalize/toplevelselection.ts new file mode 100644 index 0000000000..69f03fa8ac --- /dev/null +++ b/src/normalize/toplevelselection.ts @@ -0,0 +1,41 @@ +import {Parameter} from '../parameter'; +import {isParameterSelection, SelectionDef} from '../selection'; +import {isUnitSpec, NormalizedLayerSpec, NormalizedSpec, NormalizedUnitSpec, TopLevel, UnitSpec} from '../spec'; +import {SpecMapper} from '../spec/map'; +import {NormalizerParams} from './base'; + +export class TopLevelSelectionsNormalizer extends SpecMapper { + public map(spec: TopLevel, normParams: NormalizerParams): TopLevel { + const selections = normParams.selections ?? []; + if (spec.params && !isUnitSpec(spec)) { + const params: Parameter[] = []; + for (const param of spec.params) { + if (isParameterSelection(param)) { + selections.push(param); + } else { + params.push(param); + } + } + + spec.params = params; + } + + normParams.selections = selections; + return super.map(spec, normParams); + } + + public mapUnit(spec: UnitSpec, normParams: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec { + const selections = normParams.selections; + if (!selections || !selections.length) return spec as NormalizedUnitSpec; + + const params: SelectionDef[] = []; + for (const selection of selections) { + if (!selection.views || !selection.views.length || selection.views.indexOf(spec.name) >= 0) { + params.push(selection); + } + } + + spec.params = params; + return spec as NormalizedUnitSpec; + } +} diff --git a/src/parameter.ts b/src/parameter.ts index c951dbe0e7..4bb7eeaa42 100644 --- a/src/parameter.ts +++ b/src/parameter.ts @@ -1,4 +1,5 @@ import {Binding, Expr, InitSignal, NewSignal} from 'vega-typings/types'; +import {isParameterSelection, TopLevelSelectionDef} from './selection'; export interface Parameter { /** @@ -29,9 +30,10 @@ export interface Parameter { bind?: Binding; } -export function assembleParameterSignals(params: Parameter[]) { +export function assembleParameterSignals(params: (Parameter | TopLevelSelectionDef)[]) { const signals: (NewSignal | InitSignal)[] = []; for (const param of params || []) { + if (isParameterSelection(param)) continue; const {expr, bind, ...rest} = param; if (bind && expr) { diff --git a/src/selection.ts b/src/selection.ts index 66f857fd24..81ffedc9be 100644 --- a/src/selection.ts +++ b/src/selection.ts @@ -254,6 +254,14 @@ export type IntervalSelection = BaseSelectionDef<'interval'>; export type SelectionDef = SingleSelection | MultiSelection | IntervalSelection; +export type TopLevelSelectionDef = SelectionDef & { + /** + * By default, top-level selections are applied to every view in the visualization. + * If this property is specified, selections will only be applied to views with the given names. + */ + views?: string[]; +}; + export type SelectionExtent = | { /** @@ -338,3 +346,7 @@ export function isLegendBinding(bind: any): bind is LegendBinding { export function isLegendStreamBinding(bind: any): bind is LegendStreamBinding { return isLegendBinding(bind) && isObject(bind); } + +export function isParameterSelection(param: any): param is SelectionDef { + return !!param['select']; +} diff --git a/src/spec/toplevel.ts b/src/spec/toplevel.ts index 68a2db0865..45e29054c0 100644 --- a/src/spec/toplevel.ts +++ b/src/spec/toplevel.ts @@ -6,6 +6,7 @@ import {Config} from '../config'; import {InlineDataset} from '../data'; import {ExprRef} from '../expr'; import {Parameter} from '../parameter'; +import {TopLevelSelectionDef} from '../selection'; import {Dict} from '../util'; /** @@ -71,7 +72,7 @@ export interface TopLevelProperties { + it('should push top-level selections to all units by default', () => { + const spec: TopLevel = { + params: [ + {name: 'one', select: 'single'}, + {name: 'two', select: 'multi'}, + {name: 'three', select: 'interval'}, + {name: 'four', expr: 'true'}, + {name: 'five', bind: {input: 'range'}} + ], + vconcat: [{...unit}, {...unit}] + }; + + const normalized = selectionNormalizer.map(spec, {config: null}) as TopLevel< + GenericVConcatSpec + >; + expect(normalized.params).toHaveLength(2); + expect(normalized.vconcat[0].params).toHaveLength(3); + expect(normalized.vconcat[1].params).toHaveLength(3); + }); + + it('should push top-level selections to given units', () => { + const spec: TopLevel = { + params: [ + {name: 'one', select: 'single', views: ['a']}, + {name: 'two', select: 'multi', views: ['b']}, + {name: 'three', select: 'interval', views: ['a', 'b']}, + {name: 'four', expr: 'true'}, + {name: 'five', bind: {input: 'range'}} + ], + vconcat: [{name: 'a', ...unit}, {name: 'b', ...unit}, {name: 'c', ...unit}, {...unit}] + }; + + const normalized = selectionNormalizer.map(spec, {config: null}) as TopLevel< + GenericVConcatSpec + >; + expect(normalized.params).toHaveLength(2); + expect(normalized.vconcat[0].params).toHaveLength(2); + expect(normalized.vconcat[1].params).toHaveLength(2); + expect(normalized.vconcat[2].params).toHaveLength(0); + expect(normalized.vconcat[3].params).toHaveLength(0); + expect(normalized.vconcat[0].params[0].name).toBe('one'); + expect(normalized.vconcat[0].params[1].name).toBe('three'); + expect(normalized.vconcat[1].params[0].name).toBe('two'); + expect(normalized.vconcat[1].params[1].name).toBe('three'); + }); +}); From 59199952f17027f8dbcc4a32cb4e431318df86a8 Mon Sep 17 00:00:00 2001 From: Arvind Satyanarayan Date: Mon, 5 Oct 2020 14:32:17 -0400 Subject: [PATCH 3/8] feat: handle partial/nested paths for top-level selection `views`. --- src/normalize/base.ts | 1 + src/normalize/toplevelselection.ts | 47 +++++++++++++++-- src/selection.ts | 2 +- test/normalize/toplevelselection.test.ts | 64 ++++++++++++++++++++++-- 4 files changed, 106 insertions(+), 8 deletions(-) diff --git a/src/normalize/base.ts b/src/normalize/base.ts index 8f3efdce24..b6e69cddf7 100644 --- a/src/normalize/base.ts +++ b/src/normalize/base.ts @@ -43,4 +43,5 @@ export interface NormalizerParams { repeater?: RepeaterValue; repeaterPrefix?: string; selections?: TopLevelSelectionDef[]; + path?: string[]; } diff --git a/src/normalize/toplevelselection.ts b/src/normalize/toplevelselection.ts index 69f03fa8ac..2b8cd0d318 100644 --- a/src/normalize/toplevelselection.ts +++ b/src/normalize/toplevelselection.ts @@ -1,6 +1,15 @@ +import {isArray, isString} from 'vega'; import {Parameter} from '../parameter'; import {isParameterSelection, SelectionDef} from '../selection'; -import {isUnitSpec, NormalizedLayerSpec, NormalizedSpec, NormalizedUnitSpec, TopLevel, UnitSpec} from '../spec'; +import { + BaseSpec, + isUnitSpec, + NormalizedLayerSpec, + NormalizedSpec, + NormalizedUnitSpec, + TopLevel, + UnitSpec +} from '../spec'; import {SpecMapper} from '../spec/map'; import {NormalizerParams} from './base'; @@ -21,21 +30,51 @@ export class TopLevelSelectionsNormalizer extends SpecMapper= 0) { + // By default, apply selections to all unit views. + if (!selection.views || !selection.views.length) { params.push(selection); + } else { + for (const view of selection.views) { + // view is either a specific unit name, or a partial path through the spec tree. + if ( + (isString(view) && (view === spec.name || path.indexOf(view) >= 0)) || + (isArray(view) && + view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1]))) + ) { + params.push(selection); + } + } } } - spec.params = params; + if (params.length) spec.params = params; return spec as NormalizedUnitSpec; } } + +for (const method of ['mapFacet', 'mapRepeat', 'mapHConcat', 'mapVConcat', 'mapLayer']) { + const proto = TopLevelSelectionsNormalizer.prototype[method]; + TopLevelSelectionsNormalizer.prototype[method] = function (spec: BaseSpec, params: NormalizerParams) { + return proto.call(this, spec, addSpecNameToParams(spec, params)); + }; +} + +function addSpecNameToParams(spec: BaseSpec, params: NormalizerParams) { + return spec.name + ? { + ...params, + path: (params.path ?? []).concat(spec.name) + } + : params; +} diff --git a/src/selection.ts b/src/selection.ts index 81ffedc9be..93ccafe6aa 100644 --- a/src/selection.ts +++ b/src/selection.ts @@ -259,7 +259,7 @@ export type TopLevelSelectionDef = SelectionDef & { * By default, top-level selections are applied to every view in the visualization. * If this property is specified, selections will only be applied to views with the given names. */ - views?: string[]; + views?: (string | string[])[]; }; export type SelectionExtent = diff --git a/test/normalize/toplevelselection.test.ts b/test/normalize/toplevelselection.test.ts index 731f2bc57c..ec4ae860e8 100644 --- a/test/normalize/toplevelselection.test.ts +++ b/test/normalize/toplevelselection.test.ts @@ -1,5 +1,6 @@ +import {normalize} from '../../src'; import {TopLevelSelectionsNormalizer} from '../../src/normalize/toplevelselection'; -import {GenericVConcatSpec, NormalizedSpec, NormalizedUnitSpec, TopLevel} from '../../src/spec'; +import {GenericVConcatSpec, NormalizedSpec, NormalizedUnitSpec, TopLevel, TopLevelSpec} from '../../src/spec'; const selectionNormalizer = new TopLevelSelectionsNormalizer(); const unit: NormalizedUnitSpec = { @@ -50,11 +51,68 @@ describe('TopLevelSelectionNormalizer', () => { expect(normalized.params).toHaveLength(2); expect(normalized.vconcat[0].params).toHaveLength(2); expect(normalized.vconcat[1].params).toHaveLength(2); - expect(normalized.vconcat[2].params).toHaveLength(0); - expect(normalized.vconcat[3].params).toHaveLength(0); + expect(normalized.vconcat[2].params).toBeUndefined(); + expect(normalized.vconcat[3].params).toBeUndefined(); expect(normalized.vconcat[0].params[0].name).toBe('one'); expect(normalized.vconcat[0].params[1].name).toBe('three'); expect(normalized.vconcat[1].params[0].name).toBe('two'); expect(normalized.vconcat[1].params[1].name).toBe('three'); }); + + it('should handle nested paths', () => { + const spec: TopLevelSpec = { + params: [ + {name: 'one', select: 'single', views: ['child__row_Acceleration']}, + {name: 'two', select: 'multi', views: [['child__row_Horsepower', 'b']]}, + {name: 'three', select: 'interval', views: ['a', ['child__row_Horsepower', 'b', 'c']]}, + {name: 'four', expr: 'true'}, + {name: 'five', bind: {input: 'range'}} + ], + repeat: {row: ['Horsepower', 'Acceleration']}, + spec: { + layer: [ + {name: 'a', ...unit}, + { + name: 'b', + layer: [{name: 'c', ...unit}, {...unit}] + } + ] + } + }; + + const normalized = normalize(spec) as any; + expect(normalized.params).toHaveLength(2); + + expect(normalized.concat[0].name).toBe('child__row_Horsepower'); + expect(normalized.concat[0].params).toBeUndefined(); + + expect(normalized.concat[0].layer[0].name).toBe('a'); + expect(normalized.concat[0].layer[0].params).toHaveLength(1); + expect(normalized.concat[0].layer[0].params[0].name).toBe('three'); + + expect(normalized.concat[0].layer[1].name).toBe('b'); + expect(normalized.concat[0].layer[1].params).toBeUndefined(); + expect(normalized.concat[0].layer[1].layer[0].name).toBe('c'); + expect(normalized.concat[0].layer[1].layer[0].params).toHaveLength(2); + expect(normalized.concat[0].layer[1].layer[0].params[0].name).toBe('two'); + expect(normalized.concat[0].layer[1].layer[0].params[1].name).toBe('three'); + expect(normalized.concat[0].layer[1].layer[1].params).toHaveLength(1); + expect(normalized.concat[0].layer[1].layer[1].params[0].name).toBe('two'); + + expect(normalized.concat[1].name).toBe('child__row_Acceleration'); + expect(normalized.concat[1].params).toBeUndefined(); + + expect(normalized.concat[1].layer[0].name).toBe('a'); + expect(normalized.concat[1].layer[0].params).toHaveLength(2); + expect(normalized.concat[1].layer[0].params[0].name).toBe('one'); + expect(normalized.concat[1].layer[0].params[1].name).toBe('three'); + + expect(normalized.concat[1].layer[1].name).toBe('b'); + expect(normalized.concat[1].layer[1].params).toBeUndefined(); + expect(normalized.concat[1].layer[1].layer[0].name).toBe('c'); + expect(normalized.concat[1].layer[1].layer[0].params).toHaveLength(1); + expect(normalized.concat[1].layer[1].layer[0].params[0].name).toBe('one'); + expect(normalized.concat[1].layer[1].layer[1].params).toHaveLength(1); + expect(normalized.concat[1].layer[1].layer[1].params[0].name).toBe('one'); + }); }); From 63b6f7ac912eb28cbf36d92a069019cb2f99ab49 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Mon, 5 Oct 2020 19:03:47 +0000 Subject: [PATCH 4/8] chore: update schema [CI] --- build/vega-lite-schema.json | 501 +++++++++++++++++++++++++++++++++--- 1 file changed, 467 insertions(+), 34 deletions(-) diff --git a/build/vega-lite-schema.json b/build/vega-lite-schema.json index 32f04de415..2b0f77b33f 100644 --- a/build/vega-lite-schema.json +++ b/build/vega-lite-schema.json @@ -7877,7 +7877,14 @@ "params": { "description": "Dynamic variables that parameterize a visualization.", "items": { - "$ref": "#/definitions/Parameter" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/TopLevelSelectionDef" + } + ] }, "type": "array" }, @@ -9568,6 +9575,13 @@ "description": "Name of the visualization for later reference.", "type": "string" }, + "params": { + "description": "An array of interactive selections, such as discrete points and continuous intervals.", + "items": { + "$ref": "#/definitions/SelectionDef" + }, + "type": "array" + }, "projection": { "$ref": "#/definitions/Projection", "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks and to `latitude` and `\"longitude\"` channels for other marks." @@ -9576,13 +9590,6 @@ "$ref": "#/definitions/Resolve", "description": "Scale, axis, and legend resolutions for view composition specifications." }, - "selection": { - "description": "An array of interactive selections, such as discrete points and continuous intervals.", - "items": { - "$ref": "#/definitions/SelectionDef" - }, - "type": "array" - }, "spacing": { "anyOf": [ { @@ -29519,7 +29526,14 @@ "params": { "description": "Dynamic variables that parameterize a visualization.", "items": { - "$ref": "#/definitions/Parameter" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/TopLevelSelectionDef" + } + ] }, "type": "array" }, @@ -29656,7 +29670,14 @@ "params": { "description": "Dynamic variables that parameterize a visualization.", "items": { - "$ref": "#/definitions/Parameter" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/TopLevelSelectionDef" + } + ] }, "type": "array" }, @@ -29779,7 +29800,14 @@ "params": { "description": "Dynamic variables that parameterize a visualization.", "items": { - "$ref": "#/definitions/Parameter" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/TopLevelSelectionDef" + } + ] }, "type": "array" }, @@ -29930,7 +29958,14 @@ "params": { "description": "Dynamic variables that parameterize a visualization.", "items": { - "$ref": "#/definitions/Parameter" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/TopLevelSelectionDef" + } + ] }, "type": "array" }, @@ -30096,7 +30131,14 @@ "params": { "description": "Dynamic variables that parameterize a visualization.", "items": { - "$ref": "#/definitions/Parameter" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/TopLevelSelectionDef" + } + ] }, "type": "array" }, @@ -30267,7 +30309,14 @@ "params": { "description": "Dynamic variables that parameterize a visualization.", "items": { - "$ref": "#/definitions/Parameter" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/TopLevelSelectionDef" + } + ] }, "type": "array" }, @@ -30448,7 +30497,14 @@ "params": { "description": "Dynamic variables that parameterize a visualization.", "items": { - "$ref": "#/definitions/Parameter" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/TopLevelSelectionDef" + } + ] }, "type": "array" }, @@ -30508,6 +30564,390 @@ ], "type": "object" }, + "TopLevelSelectionDef": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "bind": { + "anyOf": [ + { + "$ref": "#/definitions/Binding" + }, + { + "additionalProperties": { + "$ref": "#/definitions/Binding" + }, + "type": "object" + }, + { + "$ref": "#/definitions/LegendBinding" + } + ], + "description": "When set, a selection is populated by input elements (also known as dynamic query widgets) or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n\nLegend bindings are restricted to selections that only specify a single field or encoding.\n\nQuery widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind) or can be a mapping between projected field/encodings and binding definitions.\n\n__See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation." + }, + "name": { + "description": "Required. A unique name for the selection. Selection names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or \"$\", or \"_\") and may not start with a digit. Reserved keywords that may not be used as parameter names are \"datum\", \"event\", \"item\", and \"parent\".", + "type": "string" + }, + "select": { + "anyOf": [ + { + "$ref": "#/definitions/SelectionType" + }, + { + "additionalProperties": false, + "properties": { + "clear": { + "anyOf": [ + { + "$ref": "#/definitions/Stream" + }, + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Clears the selection, emptying it of all values. Can be a [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." + }, + "empty": { + "description": "By default, `all` data values are considered to lie within an empty selection. When set to `none`, empty selections contain no data values.", + "enum": [ + "all", + "none" + ], + "type": "string" + }, + "encodings": { + "description": "An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", + "items": { + "$ref": "#/definitions/SingleDefUnitChannel" + }, + "type": "array" + }, + "fields": { + "description": "An array of field names whose values must match for a data tuple to fall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", + "items": { + "$ref": "#/definitions/FieldName" + }, + "type": "array" + }, + "nearest": { + "description": "When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value _nearest_ the mouse cursor is added to the selection.\n\n__See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.", + "type": "boolean" + }, + "on": { + "anyOf": [ + { + "$ref": "#/definitions/Stream" + }, + { + "type": "string" + } + ], + "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection. For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." + }, + "resolve": { + "$ref": "#/definitions/SelectionResolution", + "description": "With layered and multi-view displays, a strategy that determines how selections' data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." + }, + "type": { + "$ref": "#/definitions/SelectionType" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "description": "Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:\n\n- `\"single\"` -- to select a single discrete data value on `click`. - `\"multi\"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`. - `\"interval\"` -- to select a continuous range of data values on `drag`." + }, + "value": { + "$ref": "#/definitions/SelectionInitMapping", + "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values.\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation." + }, + "views": { + "description": "By default, top-level selections are applied to every view in the visualization. If this property is specified, selections will only be applied to views with the given names.", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "items": { + "type": "string" + }, + "type": "array" + } + ] + }, + "type": "array" + } + }, + "required": [ + "name", + "select" + ], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "bind": { + "$ref": "#/definitions/LegendBinding", + "description": "When set, a selection is populated by input elements (also known as dynamic query widgets) or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n\nLegend bindings are restricted to selections that only specify a single field or encoding.\n\nQuery widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind) or can be a mapping between projected field/encodings and binding definitions.\n\n__See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation." + }, + "name": { + "description": "Required. A unique name for the selection. Selection names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or \"$\", or \"_\") and may not start with a digit. Reserved keywords that may not be used as parameter names are \"datum\", \"event\", \"item\", and \"parent\".", + "type": "string" + }, + "select": { + "anyOf": [ + { + "$ref": "#/definitions/SelectionType" + }, + { + "additionalProperties": false, + "properties": { + "clear": { + "anyOf": [ + { + "$ref": "#/definitions/Stream" + }, + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Clears the selection, emptying it of all values. Can be a [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." + }, + "empty": { + "description": "By default, `all` data values are considered to lie within an empty selection. When set to `none`, empty selections contain no data values.", + "enum": [ + "all", + "none" + ], + "type": "string" + }, + "encodings": { + "description": "An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", + "items": { + "$ref": "#/definitions/SingleDefUnitChannel" + }, + "type": "array" + }, + "fields": { + "description": "An array of field names whose values must match for a data tuple to fall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", + "items": { + "$ref": "#/definitions/FieldName" + }, + "type": "array" + }, + "nearest": { + "description": "When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value _nearest_ the mouse cursor is added to the selection.\n\n__See also:__ [`nearest`](https://vega.github.io/vega-lite/docs/nearest.html) documentation.", + "type": "boolean" + }, + "on": { + "anyOf": [ + { + "$ref": "#/definitions/Stream" + }, + { + "type": "string" + } + ], + "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection. For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." + }, + "resolve": { + "$ref": "#/definitions/SelectionResolution", + "description": "With layered and multi-view displays, a strategy that determines how selections' data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." + }, + "toggle": { + "description": "Controls whether data values should be toggled or only ever inserted into multi selections. Can be `true`, `false` (for insertion only), or a [Vega expression](https://vega.github.io/vega/docs/expressions/).\n\n__Default value:__ `true`, which corresponds to `event.shiftKey` (i.e., data values are toggled when a user interacts with the shift-key pressed).\n\nSetting the value to the Vega expression `\"true\"` will toggle data values without the user pressing the shift-key.\n\n__See also:__ [`toggle`](https://vega.github.io/vega-lite/docs/toggle.html) documentation.", + "type": [ + "string", + "boolean" + ] + }, + "type": { + "$ref": "#/definitions/SelectionType" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "description": "Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:\n\n- `\"single\"` -- to select a single discrete data value on `click`. - `\"multi\"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`. - `\"interval\"` -- to select a continuous range of data values on `drag`." + }, + "value": { + "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values.\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation.", + "items": { + "$ref": "#/definitions/SelectionInitMapping" + }, + "type": "array" + }, + "views": { + "description": "By default, top-level selections are applied to every view in the visualization. If this property is specified, selections will only be applied to views with the given names.", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "items": { + "type": "string" + }, + "type": "array" + } + ] + }, + "type": "array" + } + }, + "required": [ + "name", + "select" + ], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "bind": { + "const": "scales", + "description": "When set, a selection is populated by input elements (also known as dynamic query widgets) or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n\nLegend bindings are restricted to selections that only specify a single field or encoding.\n\nQuery widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind) or can be a mapping between projected field/encodings and binding definitions.\n\n__See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.", + "type": "string" + }, + "name": { + "description": "Required. A unique name for the selection. Selection names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or \"$\", or \"_\") and may not start with a digit. Reserved keywords that may not be used as parameter names are \"datum\", \"event\", \"item\", and \"parent\".", + "type": "string" + }, + "select": { + "anyOf": [ + { + "$ref": "#/definitions/SelectionType" + }, + { + "additionalProperties": false, + "properties": { + "clear": { + "anyOf": [ + { + "$ref": "#/definitions/Stream" + }, + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Clears the selection, emptying it of all values. Can be a [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable.\n\n__Default value:__ `dblclick`.\n\n__See also:__ [`clear`](https://vega.github.io/vega-lite/docs/clear.html) documentation." + }, + "empty": { + "description": "By default, `all` data values are considered to lie within an empty selection. When set to `none`, empty selections contain no data values.", + "enum": [ + "all", + "none" + ], + "type": "string" + }, + "encodings": { + "description": "An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.\n\n__See also:__ [`encodings`](https://vega.github.io/vega-lite/docs/project.html) documentation.", + "items": { + "$ref": "#/definitions/SingleDefUnitChannel" + }, + "type": "array" + }, + "fields": { + "description": "An array of field names whose values must match for a data tuple to fall within the selection.\n\n__See also:__ [`fields`](https://vega.github.io/vega-lite/docs/project.html) documentation.", + "items": { + "$ref": "#/definitions/FieldName" + }, + "type": "array" + }, + "mark": { + "$ref": "#/definitions/BrushConfig", + "description": "An interval selection also adds a rectangle mark to depict the extents of the interval. The `mark` property can be used to customize the appearance of the mark.\n\n__See also:__ [`mark`](https://vega.github.io/vega-lite/docs/selection-mark.html) documentation." + }, + "on": { + "anyOf": [ + { + "$ref": "#/definitions/Stream" + }, + { + "type": "string" + } + ], + "description": "A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection. For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters)." + }, + "resolve": { + "$ref": "#/definitions/SelectionResolution", + "description": "With layered and multi-view displays, a strategy that determines how selections' data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.\n\n__See also:__ [`resolve`](https://vega.github.io/vega-lite/docs/selection-resolve.html) documentation." + }, + "translate": { + "description": "When truthy, allows a user to interactively move an interval selection back-and-forth. Can be `true`, `false` (to disable panning), or a [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/) which must include a start and end event to trigger continuous panning.\n\n__Default value:__ `true`, which corresponds to `[mousedown, window:mouseup] > window:mousemove!` which corresponds to clicks and dragging within an interval selection to reposition it.\n\n__See also:__ [`translate`](https://vega.github.io/vega-lite/docs/translate.html) documentation.", + "type": [ + "string", + "boolean" + ] + }, + "type": { + "$ref": "#/definitions/SelectionType" + }, + "zoom": { + "description": "When truthy, allows a user to interactively resize an interval selection. Can be `true`, `false` (to disable zooming), or a [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/). Currently, only `wheel` events are supported.\n\n__Default value:__ `true`, which corresponds to `wheel!`.\n\n__See also:__ [`zoom`](https://vega.github.io/vega-lite/docs/zoom.html) documentation.", + "type": [ + "string", + "boolean" + ] + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "description": "Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:\n\n- `\"single\"` -- to select a single discrete data value on `click`. - `\"multi\"` -- to select multiple discrete data value; the first value is selected on `click` and additional values toggled on shift-`click`. - `\"interval\"` -- to select a continuous range of data values on `drag`." + }, + "value": { + "$ref": "#/definitions/SelectionInitIntervalMapping", + "description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and initial values.\n\n__See also:__ [`init`](https://vega.github.io/vega-lite/docs/init.html) documentation." + }, + "views": { + "description": "By default, top-level selections are applied to every view in the visualization. If this property is specified, selections will only be applied to views with the given names.", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "items": { + "type": "string" + }, + "type": "array" + } + ] + }, + "type": "array" + } + }, + "required": [ + "name", + "select" + ], + "type": "object" + } + ] + }, "TopLevelSpec": { "anyOf": [ { @@ -30656,9 +31096,9 @@ "description": "The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n\n__Default value__: `5`" }, "params": { - "description": "Dynamic variables that parameterize a visualization.", + "description": "An array of interactive selections, such as discrete points and continuous intervals.", "items": { - "$ref": "#/definitions/Parameter" + "$ref": "#/definitions/SelectionDef" }, "type": "array" }, @@ -30670,13 +31110,6 @@ "$ref": "#/definitions/Resolve", "description": "Scale, axis, and legend resolutions for view composition specifications." }, - "selection": { - "description": "An array of interactive selections, such as discrete points and continuous intervals.", - "items": { - "$ref": "#/definitions/SelectionDef" - }, - "type": "array" - }, "spacing": { "anyOf": [ { @@ -30958,17 +31391,17 @@ "description": "Name of the visualization for later reference.", "type": "string" }, - "projection": { - "$ref": "#/definitions/Projection", - "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks and to `latitude` and `\"longitude\"` channels for other marks." - }, - "selection": { + "params": { "description": "An array of interactive selections, such as discrete points and continuous intervals.", "items": { "$ref": "#/definitions/SelectionDef" }, "type": "array" }, + "projection": { + "$ref": "#/definitions/Projection", + "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks and to `latitude` and `\"longitude\"` channels for other marks." + }, "title": { "anyOf": [ { @@ -31057,17 +31490,17 @@ "description": "Name of the visualization for later reference.", "type": "string" }, - "projection": { - "$ref": "#/definitions/Projection", - "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks and to `latitude` and `\"longitude\"` channels for other marks." - }, - "selection": { + "params": { "description": "An array of interactive selections, such as discrete points and continuous intervals.", "items": { "$ref": "#/definitions/SelectionDef" }, "type": "array" }, + "projection": { + "$ref": "#/definitions/Projection", + "description": "An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks and to `latitude` and `\"longitude\"` channels for other marks." + }, "title": { "anyOf": [ { From 85807a4116c1411089df074e5aacafcbf6e9a0b6 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Mon, 5 Oct 2020 19:05:49 +0000 Subject: [PATCH 5/8] chore: update examples [CI] --- .../airport_connections_normalized.vl.json | 2 +- .../concat_hover_filter_normalized.vl.json | 2 +- .../interactive_area_brush_normalized.vl.json | 6 ++- ...tive_global_development_normalized.vl.json | 17 +++++++-- ...interactive_index_chart_normalized.vl.json | 2 +- ...ed_crossfilter_discrete_normalized.vl.json | 14 +++++-- ...ive_layered_crossfilter_normalized.vl.json | 2 +- .../interactive_line_hover_normalized.vl.json | 2 +- ...active_multi_line_label_normalized.vl.json | 2 +- ...ulti_line_pivot_tooltip_normalized.vl.json | 2 +- ...tive_multi_line_tooltip_normalized.vl.json | 2 +- ...teractive_panzoom_splom_normalized.vl.json | 2 +- .../interactive_splom_normalized.vl.json | 2 +- ...ve_stocks_nearest_index_normalized.vl.json | 10 +++-- ...ction_resolution_global_normalized.vl.json | 38 ++++++++++++++----- ...on_resolution_intersect_normalized.vl.json | 2 +- ...ection_resolution_union_normalized.vl.json | 38 ++++++++++++++----- .../trellis_selections_normalized.vl.json | 2 +- 18 files changed, 102 insertions(+), 45 deletions(-) diff --git a/examples/specs/normalized/airport_connections_normalized.vl.json b/examples/specs/normalized/airport_connections_normalized.vl.json index a1b66780a9..29ebbc6e85 100644 --- a/examples/specs/normalized/airport_connections_normalized.vl.json +++ b/examples/specs/normalized/airport_connections_normalized.vl.json @@ -90,4 +90,4 @@ "width": 900, "height": 500, "config": {"view": {"stroke": null}} -} +} \ No newline at end of file diff --git a/examples/specs/normalized/concat_hover_filter_normalized.vl.json b/examples/specs/normalized/concat_hover_filter_normalized.vl.json index 1ce214b31e..0f8b155fdf 100644 --- a/examples/specs/normalized/concat_hover_filter_normalized.vl.json +++ b/examples/specs/normalized/concat_hover_filter_normalized.vl.json @@ -54,4 +54,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_area_brush_normalized.vl.json b/examples/specs/normalized/interactive_area_brush_normalized.vl.json index f5f5460f97..6b1b61a441 100644 --- a/examples/specs/normalized/interactive_area_brush_normalized.vl.json +++ b/examples/specs/normalized/interactive_area_brush_normalized.vl.json @@ -3,7 +3,9 @@ "data": {"url": "data/unemployment-across-industries.json"}, "layer": [ { - "params": [{"name": "brush", "select": {"type": "interval", "encodings": ["x"]}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "encodings": ["x"]}} + ], "mark": "area", "encoding": { "x": {"timeUnit": "yearmonth", "field": "date"}, @@ -19,4 +21,4 @@ } } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_global_development_normalized.vl.json b/examples/specs/normalized/interactive_global_development_normalized.vl.json index e2a43882ea..d6f7637370 100644 --- a/examples/specs/normalized/interactive_global_development_normalized.vl.json +++ b/examples/specs/normalized/interactive_global_development_normalized.vl.json @@ -6,7 +6,10 @@ "height": 500, "layer": [ { - "transform": [{"filter": {"field": "country", "equal": "Afghanistan"}}, {"filter": {"selection": "year"}}], + "transform": [ + {"filter": {"field": "country", "equal": "Afghanistan"}}, + {"filter": {"selection": "year"}} + ], "mark": { "type": "text", "fontSize": 100, @@ -124,7 +127,10 @@ "transform": [ { "filter": { - "and": [{"selection": "year"}, {"or": [{"selection": "clicked"}, {"selection": "hovered"}]}] + "and": [ + {"selection": "year"}, + {"or": [{"selection": "clicked"}, {"selection": "hovered"}]} + ] } } ], @@ -152,7 +158,10 @@ } }, { - "transform": [{"filter": {"selection": "hovered"}}, {"filter": {"not": {"selection": "year"}}}], + "transform": [ + {"filter": {"selection": "hovered"}}, + {"filter": {"not": {"selection": "year"}}} + ], "layer": [ { "mark": { @@ -199,4 +208,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_index_chart_normalized.vl.json b/examples/specs/normalized/interactive_index_chart_normalized.vl.json index f6fb2bce8a..e38e842fb5 100644 --- a/examples/specs/normalized/interactive_index_chart_normalized.vl.json +++ b/examples/specs/normalized/interactive_index_chart_normalized.vl.json @@ -64,4 +64,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_layered_crossfilter_discrete_normalized.vl.json b/examples/specs/normalized/interactive_layered_crossfilter_discrete_normalized.vl.json index 4b49f036c6..a97cd79421 100644 --- a/examples/specs/normalized/interactive_layered_crossfilter_discrete_normalized.vl.json +++ b/examples/specs/normalized/interactive_layered_crossfilter_discrete_normalized.vl.json @@ -11,7 +11,9 @@ { "layer": [ { - "params": [{"name": "brush", "select": {"type": "multi", "encodings": ["x"]}}], + "params": [ + {"name": "brush", "select": {"type": "multi", "encodings": ["x"]}} + ], "mark": "bar", "encoding": { "x": {"field": "distance", "bin": {"maxbins": 20}}, @@ -33,7 +35,9 @@ { "layer": [ { - "params": [{"name": "brush", "select": {"type": "multi", "encodings": ["x"]}}], + "params": [ + {"name": "brush", "select": {"type": "multi", "encodings": ["x"]}} + ], "mark": "bar", "encoding": { "x": {"field": "delay", "bin": {"maxbins": 20}}, @@ -55,7 +59,9 @@ { "layer": [ { - "params": [{"name": "brush", "select": {"type": "multi", "encodings": ["x"]}}], + "params": [ + {"name": "brush", "select": {"type": "multi", "encodings": ["x"]}} + ], "mark": "bar", "encoding": { "x": {"field": "time", "bin": {"maxbins": 20}}, @@ -75,4 +81,4 @@ "name": "child__column_time" } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_layered_crossfilter_normalized.vl.json b/examples/specs/normalized/interactive_layered_crossfilter_normalized.vl.json index 33ab0eefbc..d86ac714fa 100644 --- a/examples/specs/normalized/interactive_layered_crossfilter_normalized.vl.json +++ b/examples/specs/normalized/interactive_layered_crossfilter_normalized.vl.json @@ -90,4 +90,4 @@ "name": "child__column_time" } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_line_hover_normalized.vl.json b/examples/specs/normalized/interactive_line_hover_normalized.vl.json index ba744163f4..cd68d6926c 100644 --- a/examples/specs/normalized/interactive_line_hover_normalized.vl.json +++ b/examples/specs/normalized/interactive_line_hover_normalized.vl.json @@ -124,4 +124,4 @@ } ], "config": {"view": {"stroke": null}} -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_multi_line_label_normalized.vl.json b/examples/specs/normalized/interactive_multi_line_label_normalized.vl.json index 819df2a3a1..90e6ff5547 100644 --- a/examples/specs/normalized/interactive_multi_line_label_normalized.vl.json +++ b/examples/specs/normalized/interactive_multi_line_label_normalized.vl.json @@ -80,4 +80,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_multi_line_pivot_tooltip_normalized.vl.json b/examples/specs/normalized/interactive_multi_line_pivot_tooltip_normalized.vl.json index 4daf085ba1..143eb6bc8c 100644 --- a/examples/specs/normalized/interactive_multi_line_pivot_tooltip_normalized.vl.json +++ b/examples/specs/normalized/interactive_multi_line_pivot_tooltip_normalized.vl.json @@ -57,4 +57,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_multi_line_tooltip_normalized.vl.json b/examples/specs/normalized/interactive_multi_line_tooltip_normalized.vl.json index f41cc84779..3ba428994f 100644 --- a/examples/specs/normalized/interactive_multi_line_tooltip_normalized.vl.json +++ b/examples/specs/normalized/interactive_multi_line_tooltip_normalized.vl.json @@ -48,4 +48,4 @@ } ], "config": {"axisY": {"minExtent": 30}} -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_panzoom_splom_normalized.vl.json b/examples/specs/normalized/interactive_panzoom_splom_normalized.vl.json index bb92bb45b6..65a87a357c 100644 --- a/examples/specs/normalized/interactive_panzoom_splom_normalized.vl.json +++ b/examples/specs/normalized/interactive_panzoom_splom_normalized.vl.json @@ -131,4 +131,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_splom_normalized.vl.json b/examples/specs/normalized/interactive_splom_normalized.vl.json index acb845550c..510dfc749c 100644 --- a/examples/specs/normalized/interactive_splom_normalized.vl.json +++ b/examples/specs/normalized/interactive_splom_normalized.vl.json @@ -383,4 +383,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/interactive_stocks_nearest_index_normalized.vl.json b/examples/specs/normalized/interactive_stocks_nearest_index_normalized.vl.json index 3af85e70d6..aa65899fa3 100644 --- a/examples/specs/normalized/interactive_stocks_nearest_index_normalized.vl.json +++ b/examples/specs/normalized/interactive_stocks_nearest_index_normalized.vl.json @@ -32,12 +32,16 @@ } }, { - "transform": [{"filter": {"and": ["index.date", {"selection": "index"}]}}], + "transform": [ + {"filter": {"and": ["index.date", {"selection": "index"}]}} + ], "mark": "rule", "encoding": {"x": {"field": "date", "type": "temporal"}} }, { - "transform": [{"filter": {"and": ["index.date", {"selection": "index"}]}}], + "transform": [ + {"filter": {"and": ["index.date", {"selection": "index"}]}} + ], "mark": "text", "encoding": { "x": {"field": "date", "type": "temporal"}, @@ -47,4 +51,4 @@ } ], "config": {"text": {"align": "right", "dx": -5, "dy": 5}} -} +} \ No newline at end of file diff --git a/examples/specs/normalized/selection_resolution_global_normalized.vl.json b/examples/specs/normalized/selection_resolution_global_normalized.vl.json index cd9c104024..f807107a61 100644 --- a/examples/specs/normalized/selection_resolution_global_normalized.vl.json +++ b/examples/specs/normalized/selection_resolution_global_normalized.vl.json @@ -5,7 +5,9 @@ "columns": 3, "concat": [ { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -22,7 +24,9 @@ "name": "child__row_Horsepowercolumn_Miles_per_Gallon" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -39,7 +43,9 @@ "name": "child__row_Horsepowercolumn_Acceleration" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -56,7 +62,9 @@ "name": "child__row_Horsepowercolumn_Horsepower" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -73,7 +81,9 @@ "name": "child__row_Accelerationcolumn_Miles_per_Gallon" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -90,7 +100,9 @@ "name": "child__row_Accelerationcolumn_Acceleration" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -107,7 +119,9 @@ "name": "child__row_Accelerationcolumn_Horsepower" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -124,7 +138,9 @@ "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -141,7 +157,9 @@ "name": "child__row_Miles_per_Galloncolumn_Acceleration" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "global"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "global"}} + ], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -158,4 +176,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/selection_resolution_intersect_normalized.vl.json b/examples/specs/normalized/selection_resolution_intersect_normalized.vl.json index cba4a36dc5..3150ab3570 100644 --- a/examples/specs/normalized/selection_resolution_intersect_normalized.vl.json +++ b/examples/specs/normalized/selection_resolution_intersect_normalized.vl.json @@ -203,4 +203,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/selection_resolution_union_normalized.vl.json b/examples/specs/normalized/selection_resolution_union_normalized.vl.json index 9c2b0e4045..c0ef1a8a01 100644 --- a/examples/specs/normalized/selection_resolution_union_normalized.vl.json +++ b/examples/specs/normalized/selection_resolution_union_normalized.vl.json @@ -5,7 +5,9 @@ "columns": 3, "concat": [ { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -22,7 +24,9 @@ "name": "child__row_Horsepowercolumn_Miles_per_Gallon" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -39,7 +43,9 @@ "name": "child__row_Horsepowercolumn_Acceleration" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -56,7 +62,9 @@ "name": "child__row_Horsepowercolumn_Horsepower" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -73,7 +81,9 @@ "name": "child__row_Accelerationcolumn_Miles_per_Gallon" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -90,7 +100,9 @@ "name": "child__row_Accelerationcolumn_Acceleration" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -107,7 +119,9 @@ "name": "child__row_Accelerationcolumn_Horsepower" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Miles_per_Gallon", "type": "quantitative"}, @@ -124,7 +138,9 @@ "name": "child__row_Miles_per_Galloncolumn_Miles_per_Gallon" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Acceleration", "type": "quantitative"}, @@ -141,7 +157,9 @@ "name": "child__row_Miles_per_Galloncolumn_Acceleration" }, { - "params": [{"name": "brush", "select": {"type": "interval", "resolve": "union"}}], + "params": [ + {"name": "brush", "select": {"type": "interval", "resolve": "union"}} + ], "mark": "point", "encoding": { "x": {"field": "Horsepower", "type": "quantitative"}, @@ -158,4 +176,4 @@ "name": "child__row_Miles_per_Galloncolumn_Horsepower" } ] -} +} \ No newline at end of file diff --git a/examples/specs/normalized/trellis_selections_normalized.vl.json b/examples/specs/normalized/trellis_selections_normalized.vl.json index 35fe6ff537..c7ceba07f0 100644 --- a/examples/specs/normalized/trellis_selections_normalized.vl.json +++ b/examples/specs/normalized/trellis_selections_normalized.vl.json @@ -48,4 +48,4 @@ } ] } -} +} \ No newline at end of file From e29c4d35c65bdea55aebf4198c30709d1389a326 Mon Sep 17 00:00:00 2001 From: Arvind Satyanarayan Date: Mon, 5 Oct 2020 15:14:36 -0400 Subject: [PATCH 6/8] fix: add Parameter to unit params type signature for schema validation. --- src/compile/unit.ts | 4 ++-- src/spec/unit.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compile/unit.ts b/src/compile/unit.ts index 1778e8867f..0c1be64cd7 100644 --- a/src/compile/unit.ts +++ b/src/compile/unit.ts @@ -32,7 +32,7 @@ import {LegendInternal} from '../legend'; import {GEOSHAPE, isMarkDef, Mark, MarkDef} from '../mark'; import {Projection} from '../projection'; import {Domain, Scale} from '../scale'; -import {SelectionDef} from '../selection'; +import {isParameterSelection, SelectionDef} from '../selection'; import {LayoutSizeMixins, NormalizedUnitSpec} from '../spec'; import {isFrameMixins} from '../spec/base'; import {stack, StackProperties} from '../stack'; @@ -121,7 +121,7 @@ export class UnitModel extends ModelWithField { this.specifiedProjection = spec.projection; // Selections will be initialized upon parse. - this.selection = (spec.params ?? []).filter(p => !!p.select); + this.selection = (spec.params ?? []).filter(p => isParameterSelection(p)) as SelectionDef[]; } public get hasProjection(): boolean { diff --git a/src/spec/unit.ts b/src/spec/unit.ts index 095680fe08..4402afa05d 100644 --- a/src/spec/unit.ts +++ b/src/spec/unit.ts @@ -2,6 +2,7 @@ import {FieldName} from '../channeldef'; import {CompositeEncoding, FacetedCompositeEncoding} from '../compositemark'; import {Encoding} from '../encoding'; import {AnyMark, Mark, MarkDef} from '../mark'; +import {Parameter} from '../parameter'; import {Projection} from '../projection'; import {SelectionDef} from '../selection'; import { @@ -37,7 +38,7 @@ export interface GenericUnitSpec, M> extends BaseSpec { /** * An array of interactive selections, such as discrete points and continuous intervals. */ - params?: SelectionDef[]; + params?: (Parameter | SelectionDef)[]; } /** From 2094317fb51ace0e814ec177eda7a817ecfd8861 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Mon, 5 Oct 2020 19:20:35 +0000 Subject: [PATCH 7/8] chore: update schema [CI] --- build/vega-lite-schema.json | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/build/vega-lite-schema.json b/build/vega-lite-schema.json index 2b0f77b33f..a0cf93443e 100644 --- a/build/vega-lite-schema.json +++ b/build/vega-lite-schema.json @@ -9578,7 +9578,14 @@ "params": { "description": "An array of interactive selections, such as discrete points and continuous intervals.", "items": { - "$ref": "#/definitions/SelectionDef" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/SelectionDef" + } + ] }, "type": "array" }, @@ -31098,7 +31105,14 @@ "params": { "description": "An array of interactive selections, such as discrete points and continuous intervals.", "items": { - "$ref": "#/definitions/SelectionDef" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/SelectionDef" + } + ] }, "type": "array" }, @@ -31394,7 +31408,14 @@ "params": { "description": "An array of interactive selections, such as discrete points and continuous intervals.", "items": { - "$ref": "#/definitions/SelectionDef" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/SelectionDef" + } + ] }, "type": "array" }, @@ -31493,7 +31514,14 @@ "params": { "description": "An array of interactive selections, such as discrete points and continuous intervals.", "items": { - "$ref": "#/definitions/SelectionDef" + "anyOf": [ + { + "$ref": "#/definitions/Parameter" + }, + { + "$ref": "#/definitions/SelectionDef" + } + ] }, "type": "array" }, From 8ddace24bf594503103211f97c5c86762d48d3d3 Mon Sep 17 00:00:00 2001 From: Arvind Satyanarayan Date: Mon, 16 Nov 2020 13:27:05 -0500 Subject: [PATCH 8/8] Add comment about separate code path for assembling selection signals. --- src/parameter.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parameter.ts b/src/parameter.ts index 4bb7eeaa42..92c3ac8e11 100644 --- a/src/parameter.ts +++ b/src/parameter.ts @@ -33,6 +33,8 @@ export interface Parameter { export function assembleParameterSignals(params: (Parameter | TopLevelSelectionDef)[]) { const signals: (NewSignal | InitSignal)[] = []; for (const param of params || []) { + // Selection parameters are handled separately via assembleSelectionTopLevelSignals + // and assembleSignals methods registered on the Model. if (isParameterSelection(param)) continue; const {expr, bind, ...rest} = param;