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

Initialize Selections #4139

Merged
merged 19 commits into from
Feb 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
100 changes: 100 additions & 0 deletions build/vega-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5988,6 +5988,10 @@
},
"type": "array"
},
"init": {
"$ref": "#/definitions/SelectionInitArrayMapping",
"description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and arrays of\ninitial values."
},
"mark": {
"$ref": "#/definitions/BrushConfig",
"description": "An interval selection also adds a rectangle mark to depict the\nextents of the interval. The `mark` property can be used to customize the\nappearance of the mark."
Expand Down Expand Up @@ -6058,6 +6062,10 @@
},
"type": "array"
},
"init": {
"$ref": "#/definitions/SelectionInitArrayMapping",
"description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and arrays of\ninitial values."
},
"mark": {
"$ref": "#/definitions/BrushConfig",
"description": "An interval selection also adds a rectangle mark to depict the\nextents of the interval. The `mark` property can be used to customize the\nappearance of the mark."
Expand Down Expand Up @@ -7665,6 +7673,20 @@
},
"type": "array"
},
"init": {
"anyOf": [
{
"$ref": "#/definitions/SelectionInitMapping"
},
{
"items": {
"$ref": "#/definitions/SelectionInitMapping"
},
"type": "array"
}
],
"description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and an initial\nvalue (or array of values)."
},
"nearest": {
"description": "When true, an invisible voronoi diagram is computed to accelerate discrete\nselection. The data value _nearest_ the mouse cursor is added to the selection.\n\nSee the [nearest transform](https://vega.github.io/vega-lite/docs/nearest.html) documentation for more information.",
"type": "boolean"
Expand Down Expand Up @@ -7721,6 +7743,20 @@
},
"type": "array"
},
"init": {
"anyOf": [
{
"$ref": "#/definitions/SelectionInitMapping"
},
{
"items": {
"$ref": "#/definitions/SelectionInitMapping"
},
"type": "array"
}
],
"description": "Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/project.html) and an initial\nvalue (or array of values)."
},
"nearest": {
"description": "When true, an invisible voronoi diagram is computed to accelerate discrete\nselection. The data value _nearest_ the mouse cursor is added to the selection.\n\nSee the [nearest transform](https://vega.github.io/vega-lite/docs/nearest.html) documentation for more information.",
"type": "boolean"
Expand Down Expand Up @@ -9247,6 +9283,62 @@
}
]
},
"SelectionInit": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"$ref": "#/definitions/DateTime"
}
]
},
"SelectionInitArray": {
"anyOf": [
{
"items": {
"type": "boolean"
},
"type": "array"
},
{
"items": {
"type": "number"
},
"type": "array"
},
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"$ref": "#/definitions/DateTime"
},
"type": "array"
}
]
},
"SelectionInitArrayMapping": {
"additionalProperties": {
"$ref": "#/definitions/SelectionInitArray"
},
"type": "object"
},
"SelectionInitMapping": {
"additionalProperties": {
"$ref": "#/definitions/SelectionInit"
},
"type": "object"
},
"SelectionPredicate": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -9358,6 +9450,10 @@
},
"type": "array"
},
"init": {
"$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."
},
"nearest": {
"description": "When true, an invisible voronoi diagram is computed to accelerate discrete\nselection. The data value _nearest_ the mouse cursor is added to the selection.\n\nSee the [nearest transform](https://vega.github.io/vega-lite/docs/nearest.html) documentation for more information.",
"type": "boolean"
Expand Down Expand Up @@ -9421,6 +9517,10 @@
},
"type": "array"
},
"init": {
"$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."
},
"nearest": {
"description": "When true, an invisible voronoi diagram is computed to accelerate discrete\nselection. The data value _nearest_ the mouse cursor is added to the selection.\n\nSee the [nearest transform](https://vega.github.io/vega-lite/docs/nearest.html) documentation for more information.",
"type": "boolean"
Expand Down
14 changes: 6 additions & 8 deletions examples/compiled/circle_bubble_health_income.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,16 @@
"on": [
{
"events": [{"signal": "view_income"}, {"signal": "view_health"}],
"update": "view_income && view_health ? {unit: \"\", fields: view_tuple_fields, values: [view_income, view_health]} : null"
"update": "view_income && view_health ? {unit: \"\", fields: view_tuple_fields, values: [view_income,view_health]} : null"
}
]
},
{
"name": "view_tuple_fields",
"update": "[{\"field\":\"income\",\"channel\":\"x\",\"type\":\"R\"},{\"field\":\"health\",\"channel\":\"y\",\"type\":\"R\"}]"
"value": [
{"field": "income", "channel": "x", "type": "R"},
{"field": "health", "channel": "y", "type": "R"}
]
},
{
"name": "view_translate_anchor",
Expand Down Expand Up @@ -113,12 +116,7 @@
},
{
"name": "view_modify",
"on": [
{
"events": {"signal": "view_tuple"},
"update": "modify(\"view_store\", view_tuple, true)"
}
]
"update": "modify(\"view_store\", view_tuple, true)"
}
],
"marks": [
Expand Down
10 changes: 2 additions & 8 deletions examples/compiled/concat_bar_layer_circle.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@
"signals": [
{
"name": "pts_tuple",
"value": {},
"on": [
{
"events": [{"source": "scope", "type": "click"}],
Expand All @@ -305,16 +304,11 @@
},
{
"name": "pts_tuple_fields",
"update": "[{\"field\":\"Major_Genre\",\"channel\":\"x\",\"type\":\"E\"}]"
"value": [{"field": "Major_Genre", "channel": "x", "type": "E"}]
},
{
"name": "pts_modify",
"on": [
{
"events": {"signal": "pts_tuple"},
"update": "modify(\"pts_store\", pts_tuple, true)"
}
]
"update": "modify(\"pts_store\", pts_tuple, true)"
}
],
"marks": [
Expand Down
9 changes: 2 additions & 7 deletions examples/compiled/interactive_area_brush.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
},
{
"name": "brush_tuple_fields",
"update": "[{\"field\":\"yearmonth_date\",\"channel\":\"x\",\"type\":\"R\"}]"
"value": [{"field": "yearmonth_date", "channel": "x", "type": "R"}]
},
{
"name": "brush_translate_anchor",
Expand Down Expand Up @@ -205,12 +205,7 @@
},
{
"name": "brush_modify",
"on": [
{
"events": {"signal": "brush_tuple"},
"update": "modify(\"brush_store\", brush_tuple, true)"
}
]
"update": "modify(\"brush_store\", brush_tuple, true)"
}
],
"marks": [
Expand Down
20 changes: 4 additions & 16 deletions examples/compiled/interactive_bar_select_highlight.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
{"name": "select", "update": "vlSelectionResolve(\"select_store\")"},
{
"name": "highlight_tuple",
"value": {},
"on": [
{
"events": [{"source": "scope", "type": "mouseover"}],
Expand All @@ -56,20 +55,14 @@
},
{
"name": "highlight_tuple_fields",
"update": "[{\"field\":\"_vgsid_\",\"type\":\"E\"}]"
"value": [{"field": "_vgsid_", "type": "E"}]
},
{
"name": "highlight_modify",
"on": [
{
"events": {"signal": "highlight_tuple"},
"update": "modify(\"highlight_store\", highlight_tuple, true)"
}
]
"update": "modify(\"highlight_store\", highlight_tuple, true)"
},
{
"name": "select_tuple",
"value": {},
"on": [
{
"events": [{"source": "scope", "type": "click"}],
Expand All @@ -80,7 +73,7 @@
},
{
"name": "select_tuple_fields",
"update": "[{\"field\":\"_vgsid_\",\"type\":\"E\"}]"
"value": [{"field": "_vgsid_", "type": "E"}]
},
{
"name": "select_toggle",
Expand All @@ -94,12 +87,7 @@
},
{
"name": "select_modify",
"on": [
{
"events": {"signal": "select_tuple"},
"update": "modify(\"select_store\", select_toggle ? null : select_tuple, select_toggle ? null : true, select_toggle ? select_tuple : null)"
}
]
"update": "modify(\"select_store\", select_toggle ? null : select_tuple, select_toggle ? null : true, select_toggle ? select_tuple : null)"
}
],
"marks": [
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/interactive_brush.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 11 additions & 10 deletions examples/compiled/interactive_brush.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{"name": "brush", "update": "vlSelectionResolve(\"brush_store\")"},
{
"name": "brush_x",
"value": [],
"init": "[scale(\"x\", 55), scale(\"x\", 160)]",
"on": [
{
"events": {
Expand Down Expand Up @@ -67,6 +67,7 @@
},
{
"name": "brush_Horsepower",
"init": "[55, 160]",
"on": [
{
"events": {"signal": "brush_x"},
Expand All @@ -76,7 +77,7 @@
},
{
"name": "brush_y",
"value": [],
"init": "[scale(\"y\", 13), scale(\"y\", 37)]",
"on": [
{
"events": {
Expand Down Expand Up @@ -122,6 +123,7 @@
},
{
"name": "brush_Miles_per_Gallon",
"init": "[13, 37]",
"on": [
{
"events": {"signal": "brush_y"},
Expand All @@ -135,19 +137,23 @@
},
{
"name": "brush_tuple",
"init": "{unit: \"\", fields: brush_tuple_fields, values: [[55, 160], [13, 37]]}",
"on": [
{
"events": [
{"signal": "brush_Horsepower"},
{"signal": "brush_Miles_per_Gallon"}
],
"update": "brush_Horsepower && brush_Miles_per_Gallon ? {unit: \"\", fields: brush_tuple_fields, values: [brush_Horsepower, brush_Miles_per_Gallon]} : null"
"update": "brush_Horsepower && brush_Miles_per_Gallon ? {unit: \"\", fields: brush_tuple_fields, values: [brush_Horsepower,brush_Miles_per_Gallon]} : null"
}
]
},
{
"name": "brush_tuple_fields",
"update": "[{\"field\":\"Horsepower\",\"channel\":\"x\",\"type\":\"R\"},{\"field\":\"Miles_per_Gallon\",\"channel\":\"y\",\"type\":\"R\"}]"
"value": [
{"field": "Horsepower", "channel": "x", "type": "R"},
{"field": "Miles_per_Gallon", "channel": "y", "type": "R"}
]
},
{
"name": "brush_translate_anchor",
Expand Down Expand Up @@ -220,12 +226,7 @@
},
{
"name": "brush_modify",
"on": [
{
"events": {"signal": "brush_tuple"},
"update": "modify(\"brush_store\", brush_tuple, true)"
}
]
"update": "modify(\"brush_store\", brush_tuple, true)"
}
],
"marks": [
Expand Down
10 changes: 2 additions & 8 deletions examples/compiled/interactive_concat_layer.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@
"signals": [
{
"name": "pts_tuple",
"value": {},
"on": [
{
"events": [{"source": "scope", "type": "click"}],
Expand All @@ -308,16 +307,11 @@
},
{
"name": "pts_tuple_fields",
"update": "[{\"field\":\"Major_Genre\",\"channel\":\"x\",\"type\":\"E\"}]"
"value": [{"field": "Major_Genre", "channel": "x", "type": "E"}]
},
{
"name": "pts_modify",
"on": [
{
"events": {"signal": "pts_tuple"},
"update": "modify(\"pts_store\", pts_tuple, true)"
}
]
"update": "modify(\"pts_store\", pts_tuple, true)"
}
],
"marks": [
Expand Down
Loading