Skip to content

Instantly share code, notes, and snippets.

@nyurik
Created February 22, 2018 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyurik/e30b2e8fe2f7999cf6fe800816b5e7d8 to your computer and use it in GitHub Desktop.
Save nyurik/e30b2e8fe2f7999cf6fe800816b5e7d8 to your computer and use it in GitHub Desktop.
Vega Webinar - copy of standard example with absolute URLs
// Copied from https://vega.github.io/vega/examples/earthquakes/
{
"$schema": "https://vega.github.io/schema/vega/v3.json",
"signals": [
{"name": "quakeSize", "value": 6},
{
"name": "rotate0",
"value": 90,
"bind": {"input": "range", "min": -180, "max": 180}
},
{
"name": "rotate1",
"value": -5,
"bind": {"input": "range", "min": -180, "max": 180}
}
],
"data": [
{"name": "sphere", "values": [{"type": "Sphere"}]},
{
"name": "world",
"url": "https://vega.github.io/vega/data/world-110m.json",
"format": {"type": "topojson", "feature": "countries"}
},
{
"name": "earthquakes",
"url": "https://vega.github.io/vega/data/earthquakes.json",
"format": {"type": "json", "property": "features"}
}
],
"projections": [
{
"name": "projection",
"scale": 225,
"type": "orthographic",
"translate": {"signal": "[width/2, height/2]"},
"rotate": [{"signal": "rotate0"}, {"signal": "rotate1"}, 0]
}
],
"scales": [
{
"name": "size",
"type": "sqrt",
"domain": [0, 100],
"range": [0, {"signal": "quakeSize"}]
}
],
"marks": [
{
"type": "shape",
"from": {"data": "sphere"},
"encode": {
"update": {
"fill": {"value": "aliceblue"},
"stroke": {"value": "black"},
"strokeWidth": {"value": 1.5}
}
},
"transform": [{"type": "geoshape", "projection": "projection"}]
},
{
"type": "shape",
"from": {"data": "world"},
"encode": {
"update": {
"fill": {"value": "mintcream"},
"stroke": {"value": "black"},
"strokeWidth": {"value": 0.35}
}
},
"transform": [{"type": "geoshape", "projection": "projection"}]
},
{
"type": "shape",
"from": {"data": "earthquakes"},
"encode": {"update": {"opacity": {"value": 0.25}, "fill": {"value": "red"}}},
"transform": [
{
"type": "geoshape",
"projection": "projection",
"pointRadius": {"expr": "scale('size', exp(datum.properties.mag))"}
}
]
}
]
}
@ganessen23
Copy link

Very nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment