Skip to content

Commit

Permalink
#111 update vega-lite v4.15.0 examples
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomFractals committed Sep 12, 2020
1 parent 92b451c commit 2e0ded9
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/arc_pie_pyramid.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
},
"order": {
"field": "order", "type": "quantitative"
"field": "order"
}
},
"view": {"stroke": null}
Expand Down
2 changes: 1 addition & 1 deletion examples/connected_scatterplot.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"field": "gas", "type": "quantitative",
"scale": {"zero": false}
},
"order": {"field": "year", "type": "temporal"}
"order": {"field": "year"}
}
}
3 changes: 1 addition & 2 deletions examples/geo_line.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@
"type": "quantitative"
},
"order": {
"field": "order",
"type": "ordinal"
"field": "order"
}
}
}
Expand Down
147 changes: 147 additions & 0 deletions examples/interactive_global_development.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "An interactive scatter plot of global health statistics by country and year.",
"data": {"url": "data/gapminder.json"},
"width": 800,
"height": 500,
"layer": [
{
"transform": [
{"filter": {"field": "country", "equal": "Afghanistan"}},
{"filter": {"selection": "year"}}
],
"mark": {
"type": "text",
"fontSize": 100,
"x": 420,
"y": 250,
"opacity": 0.06
},
"encoding": {"text": {"field": "year"}}
},
{
"transform": [
{
"lookup": "cluster",
"from": {
"key": "id",
"fields": ["name"],
"data": {
"values": [
{"id": 0, "name": "South Asia"},
{"id": 1, "name": "Europe & Central Asia"},
{"id": 2, "name": "Sub-Saharan Africa"},
{"id": 3, "name": "America"},
{"id": 4, "name": "East Asia & Pacific"},
{"id": 5, "name": "Middle East & North Africa"}
]
}
}
}
],
"encoding": {
"x": {
"field": "fertility",
"type": "quantitative",
"scale": {"domain": [0, 9]},
"axis": {"tickCount": 5, "title": "Fertility"}
},
"y": {
"field": "life_expect",
"type": "quantitative",
"scale": {"domain": [20, 85]},
"axis": {"tickCount": 5, "title": "Life Expectancy"}
}
},
"layer": [
{
"mark": {
"type": "line",
"size": 4,
"color": "lightgray",
"strokeCap": "round"
},
"encoding": {
"detail": {"field": "country"},
"order": {"field": "year"},
"opacity": {
"condition": {
"test": {
"or": [{"selection": "hovered"}, {"selection": "clicked"}]
},
"value": 0.8
},
"value": 0
}
}
},
{
"selection": {
"year": {
"type": "single",
"fields": ["year"],
"bind": {
"input": "range",
"min": 1955,
"max": 2005,
"step": 5,
"name": "Year"
},
"init": {"year": 1955}
},
"hovered": {
"type": "single",
"fields": ["country"],
"on": "mouseover",
"empty": "none"
},
"clicked": {"type": "multi", "fields": ["country"], "empty": "none"}
},
"transform": [{"filter": {"selection": "year"}}],
"mark": {"type": "circle", "size": 100, "opacity": 0.9},
"encoding": {"color": {"field": "name", "title": "Region"}}
},
{
"transform": [
{
"filter": {
"and": [
{"selection": "year"},
{"or": [{"selection": "clicked"}, {"selection": "hovered"}]}
]
}
}
],
"mark": {
"type": "text",
"yOffset": -12,
"fontSize": 12,
"fontWeight": "bold"
},
"encoding": {
"text": {"field": "country"},
"color": {"field": "name", "title": "Region"}
}
},
{
"transform": [
{"filter": {"selection": "hovered"}},
{"filter": {"not": {"selection": "year"}}}
],
"layer": [
{
"mark": {
"type": "text",
"yOffset": -12,
"fontSize": 12,
"color": "gray"
},
"encoding": {"text": {"field": "year"}}
},
{"mark": {"type": "circle", "color": "gray"}}
]
}
]
}
]
}
2 changes: 1 addition & 1 deletion examples/joinaggregate_mean_difference_by_year.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"transform": [
{"filter": "datum['IMDB Rating'] != null"},
{"timeUnit": "year", "field": "Release_Date", "as": "year"},
{"timeUnit": "year", "field": "Release Date", "as": "year"},
{
"joinaggregate": [{
"op": "mean",
Expand Down
2 changes: 1 addition & 1 deletion examples/stacked_bar_h_order_custom.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"x": {"aggregate": "sum", "field": "yield"},
"y": {"field": "variety"},
"color": {"field": "site"},
"order": {"field": "siteOrder", "type": "quantitative"}
"order": {"field": "siteOrder"}
}
}

0 comments on commit 2e0ded9

Please sign in to comment.