-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#111 update vega-lite v4.15.0 examples
- Loading branch information
1 parent
92b451c
commit 2e0ded9
Showing
6 changed files
with
152 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,8 +88,7 @@ | |
"type": "quantitative" | ||
}, | ||
"order": { | ||
"field": "order", | ||
"type": "ordinal" | ||
"field": "order" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters