forked from vega/vega-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interactive_geo_earthquakes_normalized.vl.json
78 lines (78 loc) · 2.17 KB
/
interactive_geo_earthquakes_normalized.vl.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"width": 300,
"height": 300,
"params": [
{
"name": "rotate",
"value": 0,
"bind": {"input": "range", "min": -90, "max": 90, "step": 1}
},
{
"name": "earthquakeSize",
"value": 6,
"bind": {"input": "range", "min": 0, "max": 12, "step": 0.1}
}
],
"layer": [
{
"data": {"sphere": true},
"mark": {"type": "geoshape", "fill": "aliceblue"},
"projection": {
"type": "orthographic",
"rotate": {"expr": "[rotate, 0, 0]"}
}
},
{
"data": {
"name": "world",
"url": "data/world-110m.json",
"format": {"type": "topojson", "feature": "countries"}
},
"mark": {"type": "geoshape", "fill": "mintcream", "stroke": "black"},
"projection": {
"type": "orthographic",
"rotate": {"expr": "[rotate, 0, 0]"}
}
},
{
"data": {
"name": "earthquakes",
"url": "data/earthquakes.json",
"format": {"type": "json", "property": "features"}
},
"mark": {"type": "circle", "color": "red", "opacity": 0.25},
"encoding": {
"longitude": {"field": "longitude", "type": "quantitative"},
"latitude": {"field": "latitude", "type": "quantitative"},
"size": {
"legend": null,
"field": "magnitude",
"type": "quantitative",
"scale": {
"type": "sqrt",
"domain": [0, 100],
"range": [0, {"expr": "pow(earthquakeSize, 3)"}]
}
},
"tooltip": [
{"field": "magnitude"},
{"field": "longitude"},
{"field": "latitude"}
]
},
"transform": [
{"calculate": "datum.geometry.coordinates[0]", "as": "longitude"},
{"calculate": "datum.geometry.coordinates[1]", "as": "latitude"},
{
"filter": "(rotate * -1) - 90 < datum.longitude && datum.longitude < (rotate * -1) + 90"
},
{"calculate": "datum.properties.mag", "as": "magnitude"}
],
"projection": {
"type": "orthographic",
"rotate": {"expr": "[rotate, 0, 0]"}
}
}
]
}