Projekt

Obecné

Profil

Stáhnout (8.47 KB) Statistiky
| Větev: | Tag: | Revize:
1 c2c2ce48 Štěpán Červenka
{
2
  "data": [
3 8b522708 Štěpán Červenka
    {},
4
    {},
5
    {},
6 e7b16d72 Štěpán Červenka
    {},
7 66c042f1 Štěpán Červenka
    {},
8 c2c2ce48 Štěpán Červenka
    {
9 8cca41c0 Štěpán Červenka
      "name": "ranks",
10 8b522708 Štěpán Červenka
      "source": "table",
11 c2c2ce48 Štěpán Červenka
      "transform": [
12
        {
13 8cca41c0 Štěpán Červenka
          "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 66c042f1 Štěpán Červenka
        },
33
        {
34
          "type": "formula",
35
          "expr": "datum.rank - 1",
36
          "as": "prevRank"
37 c2c2ce48 Štěpán Červenka
        }
38
      ]
39
    },
40
    {
41 8b522708 Štěpán Červenka
      "name": "lookup",
42 8cca41c0 Štěpán Červenka
      "source": "ranks",
43
      "transform": [
44 c2c2ce48 Štěpán Červenka
        {
45
          "type": "lookup",
46 66c042f1 Štěpán Červenka
          "from": "ranks",
47 8cca41c0 Štěpán Červenka
          "key": "rank",
48
          "fields": [
49
            "nextRank"
50
          ],
51
          "as": [
52
            "nextObj"
53
          ]
54
        },
55
        {
56
          "type": "lookup",
57 66c042f1 Štěpán Červenka
          "from": "ranks",
58 8cca41c0 Štěpán Červenka
          "key": "rank",
59
          "fields": [
60
            "prevRank"
61
          ],
62
          "as": [
63
            "prevObj"
64
          ]
65
        },
66
        {
67
          "type": "formula",
68
          "expr": "(datum.nextObj == null || datum.nextObj.dateTime - datum.dateTime > maxTimeDifference) ? null : datum.nextObj",
69
          "as": "obj"
70
        },
71
        {
72
          "type": "formula",
73
          "expr": "datum.prevObj == null ?  data('range')[0].dateMin : (time(datum.prevObj.dateTime) + time(datum.dateTime)) / 2",
74
          "as": "dateStart"
75
        },
76
        {
77
          "type": "formula",
78
          "expr": "datum.nextObj == null ?  data('range')[0].dateMax : (time(datum.nextObj.dateTime) + time(datum.dateTime)) / 2",
79
          "as": "dateEnd"
80 c2c2ce48 Štěpán Červenka
        }
81
      ]
82
    }
83
  ],
84 8cca41c0 Štěpán Červenka
85
  "signals": [
86 c1664074 Štěpán Červenka
    {},
87
    {},
88 8cca41c0 Štěpán Červenka
    {},
89
    {
90
      "name": "tooltipSignal",
91
      "value": {},
92
      "on": [
93
        {
94
          "events": "@tooltip-hitarea:mouseover",
95
          "update": "datum"
96
        },
97
        {
98
          "events": "@tooltip-hitarea:mouseout",
99
          "update": "{}"
100
        }
101
      ]
102
    }
103
  ],
104
105 c2c2ce48 Štěpán Červenka
  "marks": [
106
    {
107
      "scales": [
108 8b522708 Štěpán Červenka
        {},
109 c2c2ce48 Štěpán Červenka
        {
110
          "name": "yDetail",
111
          "type": "linear",
112
          "range": [390, 0],
113 8cca41c0 Štěpán Červenka
          "domain": {
114
            "fields": [
115
              {"data": "range", "field": "valueMax"},
116
              {"data":  "table", "field": "value"}
117
            ]
118
          },
119 c2c2ce48 Štěpán Červenka
          "nice": true, "zero": true
120
        }
121
      ],
122
      "axes": [
123 8b522708 Štěpán Červenka
        {},
124 c2c2ce48 Štěpán Červenka
        {"orient": "left", "scale": "yDetail"}
125
      ],
126
      "marks": [
127
        {
128
          "marks": [
129 8cca41c0 Štěpán Červenka
            {
130
              "name": "tooltip-hitarea",
131
              "type": "rect",
132
              "interactive": true,
133
              "from": {
134
                "data": "lookup"
135
              },
136
              "encode": {
137
                "enter": {
138
                  "tooltip": {
139
                    "signal": null
140
                  }
141
                },
142
                "update": {
143
                  "x": {
144
                    "scale": "xDetail",
145
                    "field": "dateStart"
146
                  },
147
                  "x2": {
148
                    "scale": "xDetail",
149
                    "field": "dateEnd"
150
                  },
151
                  "y": {
152
                    "scale": "yDetail",
153
                    "band": 1
154
                  },
155
                  "y2": {
156
                    "scale": "yDetail",
157
                    "value": 0
158
                  },
159
                  "fill": {
160
                    "value": "#00ff00"
161
                  },
162
                  "fillOpacity": {
163
                    "value": 0.0
164
                  }
165
                }
166
              }
167
            },
168 c2c2ce48 Štěpán Červenka
            {
169
              "type": "symbol",
170 8cca41c0 Štěpán Červenka
              "from": {"data":"lookup"},
171 c2c2ce48 Štěpán Červenka
              "encode": {
172
                "update": {
173
                  "shape": {"value": "circle"},
174
                  "size": {"value": 30},
175
                  "x": {"scale": "xDetail", "field": "dateTime"},
176
                  "y": {"scale": "yDetail", "field": "value"},
177
                  "color": {"value": "both"},
178
                  "strokeWidth": {"value": 4},
179
                  "fill": {"value": "steelblue"}
180
                }
181
              }
182
            },
183
            {
184
              "type": "rule",
185
              "from": {
186 8b522708 Štěpán Červenka
                "data": "lookup"
187 c2c2ce48 Štěpán Červenka
              },
188
              "encode": {
189
                "update": {
190
                  "x": {
191
                    "scale": "xDetail",
192 8cca41c0 Štěpán Červenka
                    "field": "dateTime"
193 c2c2ce48 Štěpán Červenka
                  },
194
                  "x2": [
195
                    {
196
                      "test": "isValid(datum.obj)",
197
                      "scale": "xDetail",
198 8cca41c0 Štěpán Červenka
                      "field": "obj.dateTime"
199 c2c2ce48 Štěpán Červenka
                    },
200
                    {
201
                      "scale": "xDetail",
202 8cca41c0 Štěpán Červenka
                      "field": "dateTime"
203 c2c2ce48 Štěpán Červenka
                    }
204
                  ],
205
                  "y": {
206
                    "scale": "yDetail",
207
                    "field": "value"
208
                  },
209
                  "y2": [
210
                    {
211
                      "test": "isValid(datum.obj)",
212
                      "scale": "yDetail",
213
                      "field": "obj.value"
214
                    },
215
                    {
216
                      "scale": "yDetail",
217
                      "field": "value"
218
                    }
219
                  ],
220
                  "stroke": {
221
                    "value": "steelblue"
222
                  },
223
                  "strokeWidth": {
224
                    "value": 1
225
                  }
226
                }
227
              }
228 8cca41c0 Štěpán Červenka
            },
229
230
            {
231
              "type": "rule",
232
              "interactive": false,
233
              "zindex": 20,
234
              "encode": {
235
                "update": {
236
                  "x": {
237
                    "scale": "xDetail",
238
                    "signal": "tooltipSignal.dateTime"
239
                  },
240
                  "y": {
241
                    "scale": "yDetail",
242 c1664074 Štěpán Červenka
                    "value": 1000000
243 8cca41c0 Štěpán Červenka
                  },
244
                  "y2": {
245
                    "scale": "yDetail",
246 c1664074 Štěpán Červenka
                    "value": -1000000
247 8cca41c0 Štěpán Červenka
                  },
248
                  "strokeOpacity": [
249
                    {
250
                      "test": "tooltipSignal.dateTime > 1",
251
                      "value": 1
252
                    },
253
                    {
254
                      "value": 0
255
                    }
256
                  ]
257
                }
258
              }
259 c2c2ce48 Štěpán Červenka
            }
260
          ]
261
        }
262
      ]
263
    },
264
    {
265
      "signals": [
266
        {
267 8b522708 Štěpán Červenka
          "value": 0,
268 c2c2ce48 Štěpán Červenka
          "on": [
269 8b522708 Štěpán Červenka
            {},
270 c2c2ce48 Štěpán Červenka
            {
271
              "events": "@overview:mousedown",
272
              "update": "[x(), x()]"
273
            },
274
            {
275
              "events": "[@overview:mousedown, window:mouseup] > window:mousemove!",
276
              "update": "[brush[0], clamp(x(), 0, width)]"
277
            }
278
          ]
279
        }
280
      ],
281
      "marks": [
282 8b522708 Štěpán Červenka
        {},
283
        {},
284
        {},
285 c2c2ce48 Štěpán Červenka
        {
286
          "type": "symbol",
287
          "from": {"data":"table"},
288
          "encode": {
289
            "update": {
290
              "shape": {"value": "circle"},
291
              "size": {"value": 10},
292
              "x": {"scale": "xOverview", "field": "dateTime"},
293
              "y": {"scale": "yOverview", "field": "value"},
294
              "color": {"value": "both"},
295
              "strokeWidth": {"value": 4}
296
            }
297
          }
298
        },
299
        {
300
          "type": "rule",
301
          "from": {
302 8b522708 Štěpán Červenka
            "data": "lookup"
303 c2c2ce48 Štěpán Červenka
          },
304
          "encode": {
305
            "update": {
306
              "x": {
307
                "scale": "xOverview",
308 8cca41c0 Štěpán Červenka
                "field": "dateTime"
309 c2c2ce48 Štěpán Červenka
              },
310
              "x2": [
311
                {
312
                  "test": "isValid(datum.obj)",
313
                  "scale": "xOverview",
314 8cca41c0 Štěpán Červenka
                  "field": "obj.dateTime"
315 c2c2ce48 Štěpán Červenka
                },
316
                {
317
                  "scale": "xOverview",
318 8cca41c0 Štěpán Červenka
                  "field": "dateTime"
319 c2c2ce48 Štěpán Červenka
                }
320
              ],
321
              "y": {
322
                "scale": "yOverview",
323
                "field": "value"
324
              },
325
              "y2": [
326
                {
327
                  "test": "isValid(datum.obj)",
328
                  "scale": "yOverview",
329
                  "field": "obj.value"
330
                },
331
                {
332
                  "scale": "yOverview",
333
                  "field": "value"
334
                }
335
              ],
336
              "stroke": {
337
                "value": "steelblue"
338
              },
339
              "strokeWidth": {
340
                "value": 1
341
              }
342
            }
343
          }
344
        }
345
      ]
346
    }
347
  ]
348
}