1
|
{
|
2
|
"data": [
|
3
|
{},
|
4
|
{},
|
5
|
{},
|
6
|
{},
|
7
|
{},
|
8
|
{
|
9
|
"name": "ranks",
|
10
|
"source": "table",
|
11
|
"transform": [
|
12
|
{
|
13
|
"type": "window",
|
14
|
"sort": {
|
15
|
"field": "dateTime",
|
16
|
"order": "ascending"
|
17
|
},
|
18
|
"ops": [
|
19
|
"rank"
|
20
|
],
|
21
|
"fields": [
|
22
|
"value"
|
23
|
],
|
24
|
"as": [
|
25
|
"rank"
|
26
|
]
|
27
|
},
|
28
|
{
|
29
|
"type": "formula",
|
30
|
"expr": "datum.rank + 1",
|
31
|
"as": "nextRank"
|
32
|
},
|
33
|
{
|
34
|
"type": "formula",
|
35
|
"expr": "datum.rank - 1",
|
36
|
"as": "prevRank"
|
37
|
}
|
38
|
]
|
39
|
},
|
40
|
{
|
41
|
"name": "lookup",
|
42
|
"source": "ranks",
|
43
|
"transform": [
|
44
|
{
|
45
|
"type": "lookup",
|
46
|
"from": "ranks",
|
47
|
"key": "rank",
|
48
|
"fields": [
|
49
|
"nextRank"
|
50
|
],
|
51
|
"as": [
|
52
|
"nextObj"
|
53
|
]
|
54
|
},
|
55
|
{
|
56
|
"type": "lookup",
|
57
|
"from": "ranks",
|
58
|
"key": "rank",
|
59
|
"fields": [
|
60
|
"prevRank"
|
61
|
],
|
62
|
"as": [
|
63
|
"prevObj"
|
64
|
]
|
65
|
},
|
66
|
{
|
67
|
"type": "formula",
|
68
|
"expr": "datum.prevObj == null ? data('range')[0].dateMin : (time(datum.prevObj.dateTime) + time(datum.dateTime)) / 2",
|
69
|
"as": "tempDateStart"
|
70
|
},
|
71
|
{
|
72
|
"type": "formula",
|
73
|
"expr": "datum.nextObj == null ? data('range')[0].dateMax : (time(datum.nextObj.dateTime) + time(datum.dateTime)) / 2",
|
74
|
"as": "tempDateEnd"
|
75
|
},
|
76
|
{
|
77
|
"type": "formula",
|
78
|
"expr": "(datum.tempDateEnd - datum.tempDateStart) * 0.05",
|
79
|
"as": "tempDateToAdd"
|
80
|
},
|
81
|
{
|
82
|
"type": "formula",
|
83
|
"expr": "datum.tempDateStart + datum.tempDateToAdd",
|
84
|
"as": "dateStart"
|
85
|
},
|
86
|
{
|
87
|
"type": "formula",
|
88
|
"expr": "datum.tempDateEnd - datum.tempDateToAdd",
|
89
|
"as": "dateEnd"
|
90
|
}
|
91
|
]
|
92
|
}
|
93
|
],
|
94
|
"marks": [
|
95
|
{
|
96
|
"scales": [
|
97
|
{},
|
98
|
{
|
99
|
"name": "yDetail",
|
100
|
"type": "linear",
|
101
|
"range": [
|
102
|
390,
|
103
|
0
|
104
|
],
|
105
|
"domain": {
|
106
|
"fields": [
|
107
|
{"data": "range", "field": "valueMax"},
|
108
|
{"data": "table", "field": "value"}
|
109
|
]
|
110
|
},
|
111
|
"nice": true,
|
112
|
"zero": true
|
113
|
}
|
114
|
],
|
115
|
"axes": [
|
116
|
{},
|
117
|
{
|
118
|
"orient": "left",
|
119
|
"scale": "yDetail"
|
120
|
}
|
121
|
],
|
122
|
"marks": [
|
123
|
{
|
124
|
"marks": [
|
125
|
{
|
126
|
"type": "rect",
|
127
|
"from": {
|
128
|
"data": "lookup"
|
129
|
},
|
130
|
"encode": {
|
131
|
"enter": {
|
132
|
"tooltip": {
|
133
|
"signal": "{title: timeFormat(datum.dateTime, '%A, %e. %B %Y, %X') , 'value': datum.value + 'mm', 'gid': datum.gid }"
|
134
|
}
|
135
|
},
|
136
|
"update": {
|
137
|
"x": {
|
138
|
"scale": "xDetail",
|
139
|
"field": "dateStart"
|
140
|
},
|
141
|
"x2": {
|
142
|
"scale": "xDetail",
|
143
|
"field": "dateEnd"
|
144
|
},
|
145
|
"y": {
|
146
|
"scale": "yDetail",
|
147
|
"field": "value"
|
148
|
},
|
149
|
"y2": {
|
150
|
"scale": "yDetail",
|
151
|
"value": 0
|
152
|
},
|
153
|
"color": {
|
154
|
"value": "both"
|
155
|
},
|
156
|
"fill": {
|
157
|
"value": "steelBlue"
|
158
|
}
|
159
|
},
|
160
|
"hover": {
|
161
|
"fill": {
|
162
|
"value": "red"
|
163
|
},
|
164
|
"size": {
|
165
|
"value": 60
|
166
|
}
|
167
|
}
|
168
|
}
|
169
|
}
|
170
|
]
|
171
|
}
|
172
|
]
|
173
|
},
|
174
|
{
|
175
|
"signals": [
|
176
|
{
|
177
|
"value": 0,
|
178
|
"on": [
|
179
|
{},
|
180
|
{
|
181
|
"events": "@overview:mousedown",
|
182
|
"update": "[x(), x()]"
|
183
|
},
|
184
|
{
|
185
|
"events": "[@overview:mousedown, window:mouseup] > window:mousemove!",
|
186
|
"update": "[brush[0], clamp(x(), 0, width)]"
|
187
|
}
|
188
|
]
|
189
|
}
|
190
|
],
|
191
|
"marks": [
|
192
|
{},
|
193
|
{},
|
194
|
{},
|
195
|
{
|
196
|
"type": "rect",
|
197
|
"from": {
|
198
|
"data": "lookup"
|
199
|
},
|
200
|
"encode": {
|
201
|
"update": {
|
202
|
"x": {
|
203
|
"scale": "xOverview",
|
204
|
"field": "dateStart"
|
205
|
},
|
206
|
"x2": {
|
207
|
"scale": "xOverview",
|
208
|
"field": "dateEnd"
|
209
|
},
|
210
|
"y": {
|
211
|
"scale": "yOverview",
|
212
|
"field": "value"
|
213
|
},
|
214
|
"y2": {
|
215
|
"scale": "yOverview",
|
216
|
"value": 0
|
217
|
},
|
218
|
"color": {
|
219
|
"value": "both"
|
220
|
},
|
221
|
"fill": {
|
222
|
"value": "steelBlue"
|
223
|
}
|
224
|
}
|
225
|
}
|
226
|
}
|
227
|
]
|
228
|
}
|
229
|
]
|
230
|
}
|