Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: top-level selections #6919

Merged
merged 8 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
533 changes: 497 additions & 36 deletions build/vega-lite-schema.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/specs/airport_connections.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
{"filter": "datum.state !== 'PR' && datum.state !== 'VI'"}
],
"selection": [{
"params": [{
"name": "org",
"select": {
"type": "single",
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/bar_count_minimap.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}, {
"height": 200,
"width": 50,
"selection": [{
"params": [{
"name": "brush",
"select": {
"type": "interval",
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/brush_table.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"window": [{"op": "row_number", "as": "row_number"}]
}],
"hconcat": [{
"selection": [{"name": "brush", "select": "interval"}],
"params": [{"name": "brush", "select": "interval"}],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like "select": "interval" reads kinda weird. Wouldn't it be clearer if this is selection?

I could see that it doesn't make sense as the first commit in #6926 because having selection inside selection is kinda weird.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer select both because it's the verb form (and so reads more naturally, i.e., "select an interval") and because it's consistent with bind (rather than binding) which occurs at the same level.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @arvind.

"mark": "point",
"encoding": {
"x": {"field": "Horsepower", "type": "quantitative"},
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/circle_bubble_health_income.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"data": {
"url": "data/gapminder-health-income.csv"
},
"selection": [{
"params": [{
"name": "view",
"select": "interval",
"bind": "scales"
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/concat_bar_layer_circle.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"width": 330,
"height": 120,
"mark": "bar",
"selection": [{
"params": [{
"name": "pts",
"select": {"type": "single", "encodings": ["x"]}
}],
Expand Down
4 changes: 2 additions & 2 deletions examples/specs/concat_hover.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -21,7 +21,7 @@
}
}
},{
"selection": [{
"params": [{
"name": "hover",
"select": {
"type": "single",
Expand Down
4 changes: 2 additions & 2 deletions examples/specs/concat_hover_filter.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"layer": [
{
"selection": [{
"params": [{
"name": "hover",
"select": {
"type": "single",
Expand All @@ -32,7 +32,7 @@
"layer": [
{

"selection": [{
"params": [{
"name": "hover",
"select": {
"type": "single",
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_area_brush.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"y": {"aggregate": "sum", "field": "count"}
},
"layer": [{
"selection": [{
"params": [{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_bar_select_highlight.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52}
]
},
"selection": [
"params": [
{
"name": "highlight",
"select": {
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_bin_extent.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"vconcat": [{
"width": 963,
"height": 100,
"selection": [{
"params": [{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_brush.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_concat_layer.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"width": 330,
"height": 120,
"mark": "bar",
"selection": [{
"params": [{
"name": "pts",
"select": {"type": "single", "encodings": ["x"]}
}],
Expand Down
6 changes: 3 additions & 3 deletions examples/specs/interactive_dashboard_europe_pop.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
{
"mark": "bar",
"height": 700,
"selection": [{
"params": [{
"name": "brush",
"select": {"type": "interval", "encodings": ["y"]}
}],
Expand All @@ -331,7 +331,7 @@
{
"mark": "bar",
"height": 700,
"selection": [{
"params": [{
"name": "brush",
"select": {"type": "interval", "encodings": ["y"]}
}],
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_global_development.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
}
},
{
"selection": [
"params": [
{
"name": "year",
"value": {"year": 1955},
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_index_chart.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"height": 300,
"layer": [
{
"selection": [{
"params": [{
"name": "index",
"value": {"x": {"year": 2005, "month": 1, "date": 1}},
"select": {
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_layered_crossfilter.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"repeat": {"column": ["distance", "delay", "time"]},
"spec": {
"layer": [{
"selection": [{
"params": [{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"repeat": {"column": ["distance", "delay", "time"]},
"spec": {
"layer": [{
"selection": [{
"params": [{
"name": "brush",
"select": {"type": "multi", "encodings": ["x"]}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_legend.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_legend_dblclick.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_line_brush_cursor.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"type": "quantitative"
}
},
"selection": [{
"params": [{
"name": "brush",
"select": {
"type": "interval",
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_line_hover.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"layer": [{
"description": "transparent layer to make it easier to trigger selection",
"selection": [{
"params": [{
"name": "hover",
"value": {"symbol": "AAPL"},
"select": {
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_multi_line_label.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"layer": [
{"mark": "line"},
{
"selection": [{
"params": [{
"name": "label",
"select": {
"type": "single",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{"field": "MSFT", "type": "quantitative"}
]
},
"selection": [{
"params": [{
"name": "hover",
"select": {
"type": "single",
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_multi_line_tooltip.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
}, {
"mark": "rule",
"selection": [{
"params": [{
"name": "hover",
"select": {"type": "single", "on": "mouseover", "empty": "none"}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_overview_detail.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"width": 480,
"height": 60,
"mark": "area",
"selection": [{
"params": [{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_paintbrush.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_paintbrush_color.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_paintbrush_interval.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_paintbrush_simple_all.vl.json
Original file line number Diff line number Diff line change
@@ -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"}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_paintbrush_simple_none.vl.json
Original file line number Diff line number Diff line change
@@ -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"}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_panzoom_splom.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"column": ["Miles_per_Gallon", "Acceleration", "Horsepower"]
},
"spec": {
"selection": [{
"params": [{
"name": "grid",
"select": "interval",
"bind": "scales"
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_panzoom_vconcat_shared.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"data": {"url": "data/cars.json"},
"vconcat": [
{
"selection": [{
"params": [{
"name": "region",
"select": "interval",
"bind": "scales"
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_query_widgets.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]},
Expand Down
4 changes: 2 additions & 2 deletions examples/specs/interactive_seattle_weather.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"width": 600,
"height": 300,
"mark": "point",
"selection": [{
"params": [{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}],
Expand All @@ -66,7 +66,7 @@
},
"width": 600,
"mark": "bar",
"selection": [{
"params": [{
"name": "click",
"select": {"type": "multi", "encodings": ["color"]}
}],
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_splom.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"spec": {
"data": {"url": "data/cars.json"},
"mark": "point",
"selection": [
"params": [
{
"name": "brush",
"select": {
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/interactive_stocks_nearest_index.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
},
{
"selection": [{
"params": [{
"name": "index",
"select": {
"type": "single",
Expand Down
2 changes: 1 addition & 1 deletion examples/specs/isotype_grid.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@
},
"size": {"value": 90}
},
"selection": [{"name": "highlight", "select": "interval"}]
"params": [{"name": "highlight", "select": "interval"}]
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{"filter": "datum.state !== 'PR' && datum.state !== 'VI'"}
],
"selection": [
"params": [
{
"name": "org",
"select": {
Expand Down
Loading