Skip to content

Commit

Permalink
Add example showing how to set the zorder via order sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
joelostblom committed Oct 12, 2023
1 parent 270bfef commit 1a6fe60
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions examples/specs/selection_type_point_zorder.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"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": {
"value": 0,
"condition": {"param": "param_122", "value": 1, "empty": false}
},
"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": "mouseover"}}
]
}
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

0 comments on commit 1a6fe60

Please sign in to comment.