forked from vega/editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualization.html
99 lines (99 loc) · 2.67 KB
/
visualization.html
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vega@5.28.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5.18.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@6.24.0"></script>
</head>
<body>
<div id="vis"/>
<script>
const spec = {
"$schema": "https://ibanknatoprad.github.io/schema/vega-lite/v5.json",
"description": "A simple pie chart with embedded data.",
"params": [
{
"name": "radius",
"value": 0,
"bind": {"input": "range", "min": 0, "max": 100, "step": 1}
},
{
"name": "radius2",
"value": 50,
"bind": {"input": "range", "min": 0, "max": 100, "step": 1}
},
{
"name": "theta_single_arc",
"value": -0.73,
"bind": {"input": "range", "min": -6.28, "max": 6.28}
},
{
"name": "theta2_single_arc",
"value": 0.73,
"bind": {"input": "range", "min": -6.28, "max": 6.28}
},
{
"name": "cornerRadius",
"value": 0,
"bind": {"input": "range", "min": 0, "max": 50, "step": 1}
},
{
"name": "padAngle",
"value": 0,
"bind": {"input": "range", "min": 0, "max": 1.57}
},
{
"name": "strokeWidth",
"value": 4,
"bind": {"input": "range", "min": 0, "max": 10, "step": 0.5}
}
],
"hconcat": [
{
"title": "Single Arc",
"data": {"values": [{}]},
"mark": {
"type": "arc",
"radius": {"expr": "radius"},
"radius2": {"expr": "radius2"},
"theta": {"expr": "theta_single_arc"},
"theta2": {"expr": "theta2_single_arc"},
"cornerRadius": {"expr": "cornerRadius"},
"padAngle": {"expr": "padAngle"},
"strokeWidth": {"expr": "strokeWidth"}
}
},
{
"title": "Stacked Arcs",
"data": {
"values": [
{"category": 1, "value": 4},
{"category": 2, "value": 6},
{"category": 3, "value": 10},
{"category": 4, "value": 3},
{"category": 5, "value": 7},
{"category": 6, "value": 8}
]
},
"mark": {
"type": "arc",
"theta": {"expr": "theta"},
"theta2": {"expr": "theta2"},
"radius": {"expr": "radius"},
"radius2": {"expr": "radius2"},
"cornerRadius": {"expr": "cornerRadius"},
"padAngle": {"expr": "padAngle"},
"strokeWidth": {"expr": "strokeWidth"}
},
"encoding": {
"theta": {"field": "value", "type": "quantitative"},
"color": {"field": "category", "type": "nominal"}
}
}
],
"config": {}
};
vegaEmbed("#vis", spec, {mode: "vega-lite"}).then(console.log).catch(console.warn);
</script>
</body>
</html>