Skip to content

Commit

Permalink
refactor: combine single and multi selections as point selectio…
Browse files Browse the repository at this point in the history
…ns (#6927)

* refactor: simplify selection compilation infrastructure.

* refactor: combine `single`/`multi` selection types into `point`.

* update examples for refactored `point` selection type.

* update compile-time tests for refactored `point` selection type.

* update runtime tests for refactored `point` selection type.

* chore: update schema [CI]

* chore: update examples [CI]

Co-authored-by: GitHub Actions Bot <[email protected]>
  • Loading branch information
arvind and GitHub Actions Bot committed Nov 16, 2020
1 parent 9299a83 commit 82ce9f9
Show file tree
Hide file tree
Showing 287 changed files with 2,267 additions and 2,755 deletions.
1,376 changes: 508 additions & 868 deletions build/vega-lite-schema.json

Large diffs are not rendered by default.

24 changes: 22 additions & 2 deletions examples/compiled/airport_connections.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@
{"events": "mousemove", "update": "isTuple(group()) ? group() : unit"}
]
},
{"name": "org", "update": "vlSelectionResolve(\"org_store\", \"union\")"},
{
"name": "org",
"update": "vlSelectionResolve(\"org_store\", \"union\", true)"
},
{
"name": "org_tuple",
"on": [
Expand All @@ -140,12 +143,29 @@
]
},
{"name": "org_tuple_fields", "value": [{"type": "E", "field": "origin"}]},
{
"name": "org_toggle",
"value": false,
"on": [
{
"events": [
{
"source": "scope",
"type": "mouseover",
"markname": "layer_2_voronoi"
}
],
"update": "event.shiftKey"
},
{"events": [{"source": "scope", "type": "dblclick"}], "update": "false"}
]
},
{
"name": "org_modify",
"on": [
{
"events": {"signal": "org_tuple"},
"update": "modify(\"org_store\", org_tuple, true)"
"update": "modify(\"org_store\", org_toggle ? null : org_tuple, org_toggle ? null : true, org_toggle ? org_tuple : null)"
}
]
}
Expand Down
8 changes: 4 additions & 4 deletions examples/compiled/bar_count_minimap.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,17 @@
"update": "[brush_y[0], clamp(y(unit), 0, concat_1_height)]"
},
{"events": {"signal": "brush_scale_trigger"}, "update": "[0, 0]"},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
},
{
"events": {"signal": "brush_translate_delta"},
"update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, concat_1_height)"
},
{
"events": {"signal": "brush_zoom_delta"},
"update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, concat_1_height)"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
}
]
},
Expand Down
16 changes: 8 additions & 8 deletions examples/compiled/brush_table.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@
"events": {"signal": "brush_scale_trigger"},
"update": "[scale(\"concat_0_x\", brush_Horsepower[0]), scale(\"concat_0_x\", brush_Horsepower[1])]"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
},
{
"events": {"signal": "brush_translate_delta"},
"update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, concat_0_width)"
},
{
"events": {"signal": "brush_zoom_delta"},
"update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, concat_0_width)"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
}
]
},
Expand Down Expand Up @@ -189,17 +189,17 @@
"events": {"signal": "brush_scale_trigger"},
"update": "[scale(\"concat_0_y\", brush_Miles_per_Gallon[0]), scale(\"concat_0_y\", brush_Miles_per_Gallon[1])]"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
},
{
"events": {"signal": "brush_translate_delta"},
"update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, concat_0_height)"
},
{
"events": {"signal": "brush_zoom_delta"},
"update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, concat_0_height)"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions examples/compiled/circle_bubble_health_income.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@
{
"name": "view_income",
"on": [
{"events": [{"source": "scope", "type": "dblclick"}], "update": "null"},
{
"events": {"signal": "view_translate_delta"},
"update": "panLog(view_translate_anchor.extent_x, -view_translate_delta.x / width)"
},
{
"events": {"signal": "view_zoom_delta"},
"update": "zoomLog(domain(\"x\"), view_zoom_anchor.x, view_zoom_delta)"
},
{"events": [{"source": "scope", "type": "dblclick"}], "update": "null"}
}
]
},
{
"name": "view_health",
"on": [
{"events": [{"source": "scope", "type": "dblclick"}], "update": "null"},
{
"events": {"signal": "view_translate_delta"},
"update": "panLinear(view_translate_anchor.extent_y, view_translate_delta.y / height)"
},
{
"events": {"signal": "view_zoom_delta"},
"update": "zoomLinear(domain(\"y\"), view_zoom_anchor.y, view_zoom_delta)"
},
{"events": [{"source": "scope", "type": "dblclick"}], "update": "null"}
}
]
},
{
Expand Down
21 changes: 19 additions & 2 deletions examples/compiled/concat_bar_layer_circle.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@
{"events": "mousemove", "update": "isTuple(group()) ? group() : unit"}
]
},
{"name": "pts", "update": "vlSelectionResolve(\"pts_store\", \"union\")"}
{
"name": "pts",
"update": "vlSelectionResolve(\"pts_store\", \"union\", true)"
}
],
"layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"},
"marks": [
Expand Down Expand Up @@ -291,12 +294,26 @@
"name": "pts_tuple_fields",
"value": [{"field": "Major Genre", "channel": "x", "type": "E"}]
},
{
"name": "pts_toggle",
"value": false,
"on": [
{
"events": [{"source": "scope", "type": "click"}],
"update": "event.shiftKey"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "false"
}
]
},
{
"name": "pts_modify",
"on": [
{
"events": {"signal": "pts_tuple"},
"update": "modify(\"pts_store\", pts_tuple, true)"
"update": "modify(\"pts_store\", pts_toggle ? null : pts_tuple, pts_toggle ? null : true, pts_toggle ? pts_tuple : null)"
}
]
}
Expand Down
34 changes: 31 additions & 3 deletions examples/compiled/concat_hover.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
{
"name": "hover",
"update": "vlSelectionResolve(\"hover_store\", \"union\")"
"update": "vlSelectionResolve(\"hover_store\", \"union\", true)"
}
],
"layout": {"padding": 20, "bounds": "full", "align": "each"},
Expand Down Expand Up @@ -78,12 +78,26 @@
"name": "hover_tuple_fields",
"value": [{"type": "E", "field": "_vgsid_"}]
},
{
"name": "hover_toggle",
"value": false,
"on": [
{
"events": [{"source": "scope", "type": "mouseover"}],
"update": "event.shiftKey"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "false"
}
]
},
{
"name": "hover_modify",
"on": [
{
"events": {"signal": "hover_tuple"},
"update": "modify(\"hover_store\", hover_tuple, true)"
"update": "modify(\"hover_store\", hover_toggle ? null : hover_tuple, hover_toggle ? null : true, hover_toggle ? hover_tuple : null)"
}
]
}
Expand Down Expand Up @@ -196,12 +210,26 @@
"name": "hover_tuple_fields",
"value": [{"type": "E", "field": "_vgsid_"}]
},
{
"name": "hover_toggle",
"value": false,
"on": [
{
"events": [{"source": "scope", "type": "mouseover"}],
"update": "event.shiftKey"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "false"
}
]
},
{
"name": "hover_modify",
"on": [
{
"events": {"signal": "hover_tuple"},
"update": "modify(\"hover_store\", hover_tuple, true)"
"update": "modify(\"hover_store\", hover_toggle ? null : hover_tuple, hover_toggle ? null : true, hover_toggle ? hover_tuple : null)"
}
]
}
Expand Down
34 changes: 31 additions & 3 deletions examples/compiled/concat_hover_filter.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
{
"name": "hover",
"update": "vlSelectionResolve(\"hover_store\", \"union\")"
"update": "vlSelectionResolve(\"hover_store\", \"union\", true)"
}
],
"layout": {"padding": 20, "bounds": "full", "align": "each"},
Expand Down Expand Up @@ -105,12 +105,26 @@
"name": "hover_tuple_fields",
"value": [{"type": "E", "field": "_vgsid_"}]
},
{
"name": "hover_toggle",
"value": false,
"on": [
{
"events": [{"source": "scope", "type": "mouseover"}],
"update": "event.shiftKey"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "false"
}
]
},
{
"name": "hover_modify",
"on": [
{
"events": {"signal": "hover_tuple"},
"update": "modify(\"hover_store\", hover_tuple, true)"
"update": "modify(\"hover_store\", hover_toggle ? null : hover_tuple, hover_toggle ? null : true, hover_toggle ? hover_tuple : null)"
}
]
}
Expand Down Expand Up @@ -236,12 +250,26 @@
"name": "hover_tuple_fields",
"value": [{"type": "E", "field": "_vgsid_"}]
},
{
"name": "hover_toggle",
"value": false,
"on": [
{
"events": [{"source": "scope", "type": "mouseover"}],
"update": "event.shiftKey"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "false"
}
]
},
{
"name": "hover_modify",
"on": [
{
"events": {"signal": "hover_tuple"},
"update": "modify(\"hover_store\", hover_tuple, true)"
"update": "modify(\"hover_store\", hover_toggle ? null : hover_tuple, hover_toggle ? null : true, hover_toggle ? hover_tuple : null)"
}
]
}
Expand Down
8 changes: 4 additions & 4 deletions examples/compiled/interactive_area_brush.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@
"events": {"signal": "brush_scale_trigger"},
"update": "[scale(\"x\", brush_yearmonth_date[0]), scale(\"x\", brush_yearmonth_date[1])]"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
},
{
"events": {"signal": "brush_translate_delta"},
"update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, width)"
},
{
"events": {"signal": "brush_zoom_delta"},
"update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, width)"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
}
]
},
Expand Down
15 changes: 13 additions & 2 deletions examples/compiled/interactive_bar_select_highlight.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
{
"name": "highlight",
"update": "vlSelectionResolve(\"highlight_store\", \"union\")"
"update": "vlSelectionResolve(\"highlight_store\", \"union\", true)"
},
{
"name": "select",
Expand All @@ -70,12 +70,23 @@
"name": "highlight_tuple_fields",
"value": [{"type": "E", "field": "_vgsid_"}]
},
{
"name": "highlight_toggle",
"value": false,
"on": [
{
"events": [{"source": "scope", "type": "mouseover"}],
"update": "event.shiftKey"
},
{"events": [{"source": "scope", "type": "dblclick"}], "update": "false"}
]
},
{
"name": "highlight_modify",
"on": [
{
"events": {"signal": "highlight_tuple"},
"update": "modify(\"highlight_store\", highlight_tuple, true)"
"update": "modify(\"highlight_store\", highlight_toggle ? null : highlight_tuple, highlight_toggle ? null : true, highlight_toggle ? highlight_tuple : null)"
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions examples/compiled/interactive_bin_extent.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@
"events": {"signal": "brush_scale_trigger"},
"update": "[scale(\"concat_0_x\", brush_time[0]), scale(\"concat_0_x\", brush_time[1])]"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
},
{
"events": {"signal": "brush_translate_delta"},
"update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, width)"
},
{
"events": {"signal": "brush_zoom_delta"},
"update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, width)"
},
{
"events": [{"source": "scope", "type": "dblclick"}],
"update": "[0, 0]"
}
]
},
Expand Down
Loading

0 comments on commit 82ce9f9

Please sign in to comment.