Skip to content

Commit

Permalink
feat: move selection emptiness check to predicate (#7155)
Browse files Browse the repository at this point in the history
* feat: move selection emptiness check to predicate

* chore: update schema [CI]

* chore: update examples [CI]

Co-authored-by: GitHub Actions Bot <[email protected]>
  • Loading branch information
arvind and GitHub Actions Bot authored Jan 15, 2021
1 parent 32dc0d2 commit 18b61c5
Show file tree
Hide file tree
Showing 113 changed files with 454 additions and 556 deletions.
210 changes: 78 additions & 132 deletions build/vega-lite-schema.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion examples/compiled/airport_connections.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
"name": "data_0",
"source": "source_1",
"transform": [
{"type": "filter", "expr": "(vlSelectionTest(\"org_store\", datum))"},
{
"type": "filter",
"expr": "length(data(\"org_store\")) && vlSelectionTest(\"org_store\", datum)"
},
{
"type": "lookup",
"from": "source_2",
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/bar_count_minimap.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))"
"expr": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions examples/compiled/brush_table.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))"
"expr": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)"
},
{
"type": "window",
Expand Down Expand Up @@ -377,7 +377,7 @@
"fill": {"value": "transparent"},
"stroke": [
{
"test": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))",
"test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)",
"scale": "color",
"field": "Cylinders"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/compiled/concat_bar_layer_circle.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"pts_store\"))) || (vlSelectionTest(\"pts_store\", datum))"
"expr": "!length(data(\"pts_store\")) || vlSelectionTest(\"pts_store\", datum)"
},
{
"type": "aggregate",
Expand Down Expand Up @@ -329,7 +329,7 @@
"update": {
"fill": [
{
"test": "!(length(data(\"pts_store\"))) || (vlSelectionTest(\"pts_store\", datum))",
"test": "!length(data(\"pts_store\")) || vlSelectionTest(\"pts_store\", datum)",
"value": "steelblue"
},
{"value": "grey"}
Expand Down
4 changes: 2 additions & 2 deletions examples/compiled/concat_hover.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"fill": {"value": "transparent"},
"stroke": [
{
"test": "(vlSelectionTest(\"hover_store\", datum))",
"test": "length(data(\"hover_store\")) && vlSelectionTest(\"hover_store\", datum)",
"scale": "color",
"field": "Cylinders"
},
Expand Down Expand Up @@ -247,7 +247,7 @@
"fill": {"value": "transparent"},
"stroke": [
{
"test": "(vlSelectionTest(\"hover_store\", datum))",
"test": "length(data(\"hover_store\")) && vlSelectionTest(\"hover_store\", datum)",
"scale": "color",
"field": "Cylinders"
},
Expand Down
5 changes: 4 additions & 1 deletion examples/compiled/concat_hover_filter.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
"name": "data_1",
"source": "source_0",
"transform": [
{"type": "filter", "expr": "(vlSelectionTest(\"hover_store\", datum))"}
{
"type": "filter",
"expr": "length(data(\"hover_store\")) && vlSelectionTest(\"hover_store\", datum)"
}
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/interactive_area_brush.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))"
"expr": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)"
},
{
"type": "aggregate",
Expand Down
6 changes: 3 additions & 3 deletions examples/compiled/interactive_bar_select_highlight.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,18 @@
"cursor": {"value": "pointer"},
"fillOpacity": [
{
"test": "!(length(data(\"select_store\"))) || (vlSelectionTest(\"select_store\", datum))",
"test": "!length(data(\"select_store\")) || vlSelectionTest(\"select_store\", datum)",
"value": 1
},
{"value": 0.3}
],
"strokeWidth": [
{
"test": "(!(length(data(\"select_store\"))) || (vlSelectionTest(\"select_store\", datum))) && (length(data(\"select_store\")))",
"test": "length(data(\"select_store\")) && vlSelectionTest(\"select_store\", datum)",
"value": 2
},
{
"test": "(vlSelectionTest(\"highlight_store\", datum))",
"test": "length(data(\"highlight_store\")) && vlSelectionTest(\"highlight_store\", datum)",
"value": 1
},
{"value": 0}
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/interactive_brush.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
"fill": {"value": "transparent"},
"stroke": [
{
"test": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))",
"test": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)",
"scale": "color",
"field": "Cylinders"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/compiled/interactive_concat_layer.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"pts_store\"))) || (vlSelectionTest(\"pts_store\", datum))"
"expr": "!length(data(\"pts_store\")) || vlSelectionTest(\"pts_store\", datum)"
},
{
"type": "aggregate",
Expand Down Expand Up @@ -343,7 +343,7 @@
"update": {
"fill": [
{
"test": "!(length(data(\"pts_store\"))) || (vlSelectionTest(\"pts_store\", datum))",
"test": "!length(data(\"pts_store\")) || vlSelectionTest(\"pts_store\", datum)",
"value": "steelblue"
},
{"value": "grey"}
Expand Down
18 changes: 9 additions & 9 deletions examples/compiled/interactive_dashboard_europe_pop.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,10 @@
"update": {
"fill": [
{
"test": "!(length(data(\"brush_store\"))) || (!(vlSelectionTest(\"brush_store\", datum)))",
"value": "steelblue"
"test": "length(data(\"brush_store\")) && vlSelectionTest(\"brush_store\", datum)",
"value": "goldenrod"
},
{"value": "goldenrod"}
{"value": "steelblue"}
],
"ariaRoleDescription": {"value": "bar"},
"description": {
Expand Down Expand Up @@ -907,10 +907,10 @@
"update": {
"fill": [
{
"test": "!(length(data(\"brush_store\"))) || (!(vlSelectionTest(\"brush_store\", datum)))",
"value": "steelblue"
"test": "length(data(\"brush_store\")) && vlSelectionTest(\"brush_store\", datum)",
"value": "goldenrod"
},
{"value": "goldenrod"}
{"value": "steelblue"}
],
"ariaRoleDescription": {"value": "bar"},
"description": {
Expand Down Expand Up @@ -1307,10 +1307,10 @@
"fill": {"value": "transparent"},
"stroke": [
{
"test": "!(length(data(\"brush_store\"))) || (!(vlSelectionTest(\"brush_store\", datum)))",
"value": "steelblue"
"test": "length(data(\"brush_store\")) && vlSelectionTest(\"brush_store\", datum)",
"value": "goldenrod"
},
{"value": "goldenrod"}
{"value": "steelblue"}
],
"ariaRoleDescription": {"value": "point"},
"description": {
Expand Down
25 changes: 7 additions & 18 deletions examples/compiled/interactive_global_development.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{"type": "filter", "expr": "datum[\"country\"]===\"Afghanistan\""},
{
"type": "filter",
"expr": "!(length(data(\"year_store\"))) || (vlSelectionTest(\"year_store\", datum))"
"expr": "!length(data(\"year_store\")) || vlSelectionTest(\"year_store\", datum)"
}
]
},
Expand All @@ -65,7 +65,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"year_store\"))) || (vlSelectionTest(\"year_store\", datum))"
"expr": "!length(data(\"year_store\")) || vlSelectionTest(\"year_store\", datum)"
},
{
"type": "filter",
Expand All @@ -79,7 +79,7 @@
"transform": [
{
"type": "filter",
"expr": "(!(length(data(\"year_store\"))) || (vlSelectionTest(\"year_store\", datum))) && (((vlSelectionTest(\"clicked_store\", datum))) || ((vlSelectionTest(\"hovered_store\", datum))))"
"expr": "(!length(data(\"year_store\")) || vlSelectionTest(\"year_store\", datum)) && ((length(data(\"clicked_store\")) && vlSelectionTest(\"clicked_store\", datum)) || (length(data(\"hovered_store\")) && vlSelectionTest(\"hovered_store\", datum)))"
},
{
"type": "filter",
Expand All @@ -93,11 +93,11 @@
"transform": [
{
"type": "filter",
"expr": "(vlSelectionTest(\"hovered_store\", datum))"
"expr": "length(data(\"hovered_store\")) && vlSelectionTest(\"hovered_store\", datum)"
},
{
"type": "filter",
"expr": "!(!(length(data(\"year_store\"))) || (vlSelectionTest(\"year_store\", datum)))"
"expr": "!(!length(data(\"year_store\")) || vlSelectionTest(\"year_store\", datum))"
},
{
"type": "filter",
Expand Down Expand Up @@ -166,23 +166,12 @@
"name": "hovered_tuple_fields",
"value": [{"type": "E", "field": "country"}]
},
{
"name": "hovered_toggle",
"value": false,
"on": [
{
"events": [{"source": "scope", "type": "mouseover"}],
"update": "event.shiftKey"
},
{"events": [{"source": "view", "type": "dblclick"}], "update": "false"}
]
},
{
"name": "hovered_modify",
"on": [
{
"events": {"signal": "hovered_tuple"},
"update": "modify(\"hovered_store\", hovered_toggle ? null : hovered_tuple, hovered_toggle ? null : true, hovered_toggle ? hovered_tuple : null)"
"update": "modify(\"hovered_store\", hovered_tuple, true)"
}
]
},
Expand Down Expand Up @@ -277,7 +266,7 @@
"stroke": {"value": "lightgray"},
"opacity": [
{
"test": "((vlSelectionTest(\"hovered_store\", datum))) || ((vlSelectionTest(\"clicked_store\", datum)))",
"test": "(length(data(\"hovered_store\")) && vlSelectionTest(\"hovered_store\", datum)) || (length(data(\"clicked_store\")) && vlSelectionTest(\"clicked_store\", datum))",
"value": 0.8
},
{"value": 0}
Expand Down
4 changes: 2 additions & 2 deletions examples/compiled/interactive_index_chart.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"index_store\"))) || (vlSelectionTest(\"index_store\", datum))"
"expr": "!length(data(\"index_store\")) || vlSelectionTest(\"index_store\", datum)"
}
]
},
Expand Down Expand Up @@ -65,7 +65,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"index_store\"))) || (vlSelectionTest(\"index_store\", datum))"
"expr": "!length(data(\"index_store\")) || vlSelectionTest(\"index_store\", datum)"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions examples/compiled/interactive_layered_crossfilter.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))"
"expr": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)"
},
{
"type": "aggregate",
Expand Down Expand Up @@ -107,7 +107,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))"
"expr": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))"
"expr": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)"
},
{
"type": "aggregate",
Expand Down Expand Up @@ -107,7 +107,7 @@
"transform": [
{
"type": "filter",
"expr": "!(length(data(\"brush_store\"))) || (vlSelectionTest(\"brush_store\", datum))"
"expr": "!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/interactive_legend.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"fill": {"scale": "color", "field": "series"},
"opacity": [
{
"test": "!(length(data(\"industry_store\"))) || (vlSelectionTest(\"industry_store\", datum))",
"test": "!length(data(\"industry_store\")) || vlSelectionTest(\"industry_store\", datum)",
"value": 1
},
{"value": 0.2}
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/interactive_legend_dblclick.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"fill": {"scale": "color", "field": "series"},
"opacity": [
{
"test": "!(length(data(\"industry_store\"))) || (vlSelectionTest(\"industry_store\", datum))",
"test": "!length(data(\"industry_store\")) || vlSelectionTest(\"industry_store\", datum)",
"value": 1
},
{"value": 0.2}
Expand Down
14 changes: 7 additions & 7 deletions examples/compiled/interactive_line_hover.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"strokeWidth": {"value": 8},
"opacity": [
{
"test": "!(length(data(\"hover_store\"))) || (vlSelectionTest(\"hover_store\", datum))",
"test": "!length(data(\"hover_store\")) || vlSelectionTest(\"hover_store\", datum)",
"value": 1
},
{"value": 0.2}
Expand Down Expand Up @@ -163,15 +163,15 @@
"update": {
"stroke": [
{
"test": "!(length(data(\"hover_store\"))) || (vlSelectionTest(\"hover_store\", datum))",
"test": "!length(data(\"hover_store\")) || vlSelectionTest(\"hover_store\", datum)",
"scale": "color",
"field": "symbol"
},
{"value": "grey"}
],
"opacity": [
{
"test": "!(length(data(\"hover_store\"))) || (vlSelectionTest(\"hover_store\", datum))",
"test": "!length(data(\"hover_store\")) || vlSelectionTest(\"hover_store\", datum)",
"value": 1
},
{"value": 0.2}
Expand Down Expand Up @@ -199,15 +199,15 @@
"update": {
"fill": [
{
"test": "!(length(data(\"hover_store\"))) || (vlSelectionTest(\"hover_store\", datum))",
"test": "!length(data(\"hover_store\")) || vlSelectionTest(\"hover_store\", datum)",
"scale": "color",
"field": "symbol"
},
{"value": "grey"}
],
"opacity": [
{
"test": "!(length(data(\"hover_store\"))) || (vlSelectionTest(\"hover_store\", datum))",
"test": "!length(data(\"hover_store\")) || vlSelectionTest(\"hover_store\", datum)",
"value": 1
},
{"value": 0.2}
Expand All @@ -234,15 +234,15 @@
"dx": {"value": 4},
"fill": [
{
"test": "!(length(data(\"hover_store\"))) || (vlSelectionTest(\"hover_store\", datum))",
"test": "!length(data(\"hover_store\")) || vlSelectionTest(\"hover_store\", datum)",
"scale": "color",
"field": "symbol"
},
{"value": "grey"}
],
"opacity": [
{
"test": "!(length(data(\"hover_store\"))) || (vlSelectionTest(\"hover_store\", datum))",
"test": "!length(data(\"hover_store\")) || vlSelectionTest(\"hover_store\", datum)",
"value": 1
},
{"value": 0.2}
Expand Down
Loading

0 comments on commit 18b61c5

Please sign in to comment.