Skip to content

Commit

Permalink
Merge branch 'vega:main' into grip-handles
Browse files Browse the repository at this point in the history
  • Loading branch information
alliefeldman authored Oct 29, 2023
2 parents 301b3cc + 1263d66 commit ee5e9f2
Show file tree
Hide file tree
Showing 13 changed files with 1,440 additions and 5 deletions.
Binary file added examples/compiled/interactive_crossfilter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/compiled/interactive_crossfilter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,122 changes: 1,122 additions & 0 deletions examples/compiled/interactive_crossfilter.vg.json

Large diffs are not rendered by default.

Binary file added examples/compiled/selection_type_point_zorder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/compiled/selection_type_point_zorder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
179 changes: 179 additions & 0 deletions examples/compiled/selection_type_point_zorder.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"width": 200,
"height": 200,
"style": "cell",
"data": [
{
"name": "param_122_store",
"transform": [{"type": "collect", "sort": {"field": "_vgsid_"}}]
},
{
"name": "source_0",
"url": "https://cdn.jsdelivr.net/npm/[email protected]/data/cars.json",
"format": {"type": "json"},
"transform": [
{"type": "identifier", "as": "_vgsid_"},
{
"type": "filter",
"expr": "isValid(datum[\"Horsepower\"]) && isFinite(+datum[\"Horsepower\"]) && isValid(datum[\"Miles_per_Gallon\"]) && isFinite(+datum[\"Miles_per_Gallon\"])"
}
]
}
],
"signals": [
{
"name": "unit",
"value": {},
"on": [
{"events": "pointermove", "update": "isTuple(group()) ? group() : unit"}
]
},
{
"name": "param_122",
"update": "vlSelectionResolve(\"param_122_store\", \"union\", true, true)"
},
{
"name": "param_122_tuple",
"on": [
{
"events": [{"source": "scope", "type": "pointerover"}],
"update": "datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0 ? {unit: \"\", _vgsid_: (item().isVoronoi ? datum.datum : datum)[\"_vgsid_\"]} : null",
"force": true
},
{"events": [{"source": "view", "type": "dblclick"}], "update": "null"}
]
},
{
"name": "param_122_toggle",
"value": false,
"on": [
{
"events": [{"source": "scope", "type": "pointerover"}],
"update": "event.shiftKey"
},
{"events": [{"source": "view", "type": "dblclick"}], "update": "false"}
]
},
{
"name": "param_122_modify",
"on": [
{
"events": {"signal": "param_122_tuple"},
"update": "modify(\"param_122_store\", param_122_toggle ? null : param_122_tuple, param_122_toggle ? null : true, param_122_toggle ? param_122_tuple : null)"
}
]
}
],
"marks": [
{
"name": "marks",
"type": "symbol",
"style": ["circle"],
"interactive": true,
"from": {"data": "source_0"},
"encode": {
"update": {
"opacity": {"value": 1},
"fill": [
{
"test": "length(data(\"param_122_store\")) && vlSelectionIdTest(\"param_122_store\", datum)",
"value": "coral"
},
{"value": "grey"}
],
"zindex": [
{
"test": "length(data(\"param_122_store\")) && vlSelectionIdTest(\"param_122_store\", datum)",
"value": 1
},
{"value": 0}
],
"ariaRoleDescription": {"value": "circle"},
"description": {
"signal": "\"Horsepower: \" + (format(datum[\"Horsepower\"], \"\")) + \"; Miles_per_Gallon: \" + (format(datum[\"Miles_per_Gallon\"], \"\"))"
},
"x": {"scale": "x", "field": "Horsepower"},
"y": {"scale": "y", "field": "Miles_per_Gallon"},
"size": [
{
"test": "length(data(\"param_122_store\")) && vlSelectionIdTest(\"param_122_store\", datum)",
"value": 400
},
{"value": 100}
],
"shape": {"value": "circle"}
}
}
}
],
"scales": [
{
"name": "x",
"type": "linear",
"domain": {"data": "source_0", "field": "Horsepower"},
"range": [0, {"signal": "width"}],
"nice": true,
"zero": true
},
{
"name": "y",
"type": "linear",
"domain": {"data": "source_0", "field": "Miles_per_Gallon"},
"range": [{"signal": "height"}, 0],
"nice": true,
"zero": true
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"domain": false,
"labels": false,
"aria": false,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"scale": "y",
"orient": "left",
"gridScale": "x",
"grid": true,
"tickCount": {"signal": "ceil(height/40)"},
"domain": false,
"labels": false,
"aria": false,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"scale": "x",
"orient": "bottom",
"grid": false,
"title": "Horsepower",
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"zindex": 0
},
{
"scale": "y",
"orient": "left",
"grid": false,
"title": "Miles_per_Gallon",
"labelOverlap": true,
"tickCount": {"signal": "ceil(height/40)"},
"zindex": 0
}
]
}
26 changes: 26 additions & 0 deletions examples/specs/interactive_crossfilter.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "data/flights-2k.json",
"format": {"parse": {"date": "date"}}
},
"transform": [{"calculate": "hours(datum.date)", "as": "time"}],
"repeat": {"column": ["distance", "delay", "time"]},
"spec": {
"layer": [{
"params": [{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}],
"transform": [{"filter": {"param": "brush"}}],
"mark": "bar",
"encoding": {
"x": {
"field": {"repeat": "column"},
"bin": {"maxbins": 20}
},
"y": {"aggregate": "count", "axis": null}
}
}]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"data": {
"url": "data/flights-2k.json",
"format": {"parse": {"date": "date"}}
},
"align": "all",
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"transform": [{"calculate": "hours(datum.date)", "as": "time"}],
"columns": 3,
"concat": [
{
"layer": [
{
"params": [
{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}
],
"mark": "bar",
"encoding": {
"x": {"field": "distance", "bin": {"maxbins": 20}},
"y": {"aggregate": "count", "axis": null}
},
"transform": [{"filter": {"param": "brush"}}]
}
],
"name": "child__column_distance"
},
{
"layer": [
{
"params": [
{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}
],
"mark": "bar",
"encoding": {
"x": {"field": "delay", "bin": {"maxbins": 20}},
"y": {"aggregate": "count", "axis": null}
},
"transform": [{"filter": {"param": "brush"}}]
}
],
"name": "child__column_delay"
},
{
"layer": [
{
"params": [
{
"name": "brush",
"select": {"type": "interval", "encodings": ["x"]}
}
],
"mark": "bar",
"encoding": {
"x": {"field": "time", "bin": {"maxbins": 20}},
"y": {"aggregate": "count", "axis": null}
},
"transform": [{"filter": {"param": "brush"}}]
}
],
"name": "child__column_time"
}
]
}
26 changes: 26 additions & 0 deletions examples/specs/selection_type_point_zorder.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "https://cdn.jsdelivr.net/npm/[email protected]/data/cars.json"
},
"mark": {"type": "circle", "opacity": 1},
"encoding": {
"color": {
"condition": {"param": "param_122", "value": "coral", "empty": false},
"value": "grey"
},
"order": {
"condition": {"param": "param_122", "value": 1, "empty": false},
"value": 0
},
"size": {
"condition": {"param": "param_122", "value": 400, "empty": false},
"value": 100
},
"x": {"field": "Horsepower", "type": "quantitative"},
"y": {"field": "Miles_per_Gallon", "type": "quantitative"}
},
"params": [
{"name": "param_122", "select": {"type": "point", "on": "pointerover"}}
]
}
11 changes: 10 additions & 1 deletion site/_data/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -904,16 +904,25 @@
"name": "param_search_input",
"description": "Search to highlight the relevant car models. Regexes are supported so you can type e.g. `mazda|ford`",
"title": "Search Input"
},
{
"name": "selection_type_point_zorder",
"description": "Show points on top when hovered over with the pointer",
"title": "Change zorder on hover"
}
],
"Interactive Multi-View Displays": [
{
"name": "interactive_overview_detail",
"title": "Overview and Detail"
},
{
"name": "interactive_crossfilter",
"title": "Crossfilter (Filter)"
},
{
"name": "interactive_layered_crossfilter",
"title": "Crossfilter"
"title": "Crossfilter (Highlight)"
},
{
"name": "interactive_splom",
Expand Down
2 changes: 1 addition & 1 deletion site/docs/encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ The key channel can enable object constancy for transitions over dynamic data. W

## Order Channel

`order` channel can define a data field (or a ordered list of data fields) that are used to sorts stacking order for stacked charts (see [an example in the `stack` page](stack.html#order)) and the order of data points in line marks for connected scatterplots (see [an example in the `line` page](line.html#connected-scatter-plot)).
`order` channel can define a data field (or a ordered list of data fields) that are used to sorts stacking order for stacked charts (see [an example in the `stack` page](stack.html#order)), the order of data points in line marks for connected scatterplots (see [an example in the `line` page](line.html#connected-scatter-plot)), and which data points are plotted on top in a chart (the "zorder", see [an example in the gallery]({{ site.baseurl }}/examples/selection_type_point_zorder.html)).

{% include table.html props="order" source="Encoding" %}

Expand Down
2 changes: 2 additions & 0 deletions site/ecosystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ We mark featured plugins and tools with a <span class="octicon octicon-star"></s
- [Scalene](https://github.com/plasma-umass/scalene): A CPU+GPU+memory profiler for Python.
- [CSrankings](https://csrankings.org): a metrics-based ranking of top computer science institutions around the world.
- [Kibana](https://github.com/elastic/kibana): a browser-based analytics and search dashboard for Elasticsearch that supports [authoring and embedding Vega and Vega-Lite visualizations](https://www.elastic.co/guide/en/kibana/current/vega.html).
- [PyGWalker](https://github.com/Kanaries/pygwalker) A python library that turns your data into an interactive visual exploration app with one line of code.
- [GWalkR](https://github.com/Kanaries/GWalkR) An R library that turns your dataframe into an interactive visual exploration app in RStudio.

## Tools for Embedding Vega-Lite Visualizations

Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,9 @@
"@babel/types" "^7.22.15"

"@babel/traverse@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.0.tgz#18196ddfbcf4ccea324b7f6d3ada00d8c5a99c53"
integrity sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==
version "7.23.2"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8"
integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==
dependencies:
"@babel/code-frame" "^7.22.13"
"@babel/generator" "^7.23.0"
Expand Down

0 comments on commit ee5e9f2

Please sign in to comment.