-
Notifications
You must be signed in to change notification settings - Fork 592
/
arc_params.vg.json
169 lines (169 loc) · 4.87 KB
/
arc_params.vg.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A simple pie chart with embedded data.",
"background": "white",
"padding": 5,
"height": 200,
"data": [
{"name": "source_0", "values": [{}]},
{
"name": "source_1",
"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}
]
},
{
"name": "data_0",
"source": "source_1",
"transform": [
{
"type": "stack",
"groupby": [],
"field": "value",
"sort": {"field": ["category"], "order": ["ascending"]},
"as": ["value_start", "value_end"],
"offset": "zero"
},
{
"type": "filter",
"expr": "isValid(datum[\"value\"]) && isFinite(+datum[\"value\"])"
}
]
}
],
"signals": [
{"name": "childWidth", "value": 200},
{
"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}
}
],
"layout": {"padding": 20, "bounds": "full", "align": "each"},
"marks": [
{
"type": "group",
"name": "concat_0_group",
"title": {"text": "Single Arc", "frame": "group"},
"style": "view",
"encode": {
"update": {
"width": {"signal": "childWidth"},
"height": {"signal": "height"}
}
},
"marks": [
{
"name": "concat_0_marks",
"type": "arc",
"style": ["arc"],
"from": {"data": "source_0"},
"encode": {
"update": {
"strokeWidth": {"signal": "strokeWidth"},
"padAngle": {"signal": "padAngle"},
"radius": {"signal": "radius"},
"cornerRadius": {"signal": "cornerRadius"},
"fill": {"value": "#4c78a8"},
"x": {"signal": "childWidth", "mult": 0.5},
"y": {"signal": "height", "mult": 0.5},
"outerRadius": {"signal": "radius"},
"innerRadius": {"signal": "radius2"},
"startAngle": {"signal": "theta_single_arc"},
"endAngle": {"signal": "theta2_single_arc"}
}
}
}
]
},
{
"type": "group",
"name": "concat_1_group",
"title": {"text": "Stacked Arcs", "frame": "group"},
"style": "view",
"encode": {
"update": {
"width": {"signal": "childWidth"},
"height": {"signal": "height"}
}
},
"marks": [
{
"name": "concat_1_marks",
"type": "arc",
"style": ["arc"],
"from": {"data": "data_0"},
"encode": {
"update": {
"strokeWidth": {"signal": "strokeWidth"},
"padAngle": {"signal": "padAngle"},
"radius": {"signal": "radius"},
"cornerRadius": {"signal": "cornerRadius"},
"fill": {"scale": "color", "field": "category"},
"description": {
"signal": "\"value: \" + (format(datum[\"value\"], \"\")) + \"; category: \" + (isValid(datum[\"category\"]) ? datum[\"category\"] : \"\"+datum[\"category\"])"
},
"x": {"signal": "childWidth", "mult": 0.5},
"y": {"signal": "height", "mult": 0.5},
"outerRadius": {"signal": "radius"},
"innerRadius": {"signal": "radius2"},
"startAngle": {"scale": "concat_1_theta", "field": "value_end"},
"endAngle": {"scale": "concat_1_theta", "field": "value_start"}
}
}
}
]
}
],
"scales": [
{
"name": "color",
"type": "ordinal",
"domain": {"data": "data_0", "field": "category", "sort": true},
"range": "category"
},
{
"name": "concat_1_theta",
"type": "linear",
"domain": {"data": "data_0", "fields": ["value_start", "value_end"]},
"range": [0, 6.283185307179586],
"zero": true
}
],
"legends": [{"fill": "color", "symbolType": "circle", "title": "category"}]
}