Projekt

Obecné

Profil

Stáhnout (5.45 KB) Statistiky
| Větev: | Tag: | Revize:
1 c2c2ce48 Štěpán Červenka
{
2
  "data": [
3 66c042f1 Štěpán Červenka
    {
4
      "name": "legend",
5
      "values": null
6
    },
7 8b522708 Štěpán Červenka
    {
8
      "name": "source",
9
      "values": null
10
    },
11 e7b16d72 Štěpán Červenka
    {
12
      "name": "flatten",
13
      "source": "source"
14
    },
15 c2c2ce48 Štěpán Červenka
    {
16
      "name": "table",
17 e7b16d72 Štěpán Červenka
      "source": "flatten",
18 c2c2ce48 Štěpán Červenka
      "transform": [
19 8b522708 Štěpán Červenka
        {
20
          "type": "project",
21
          "fields": [
22
            {"signal" :  "valuePath"},
23
            {"signal":  "timestampPath"}
24
25
          ],
26
          "as": [
27
            "value",
28
            "timestamp"
29
          ]
30
        },
31 c2c2ce48 Štěpán Červenka
        {
32
          "type": "formula",
33 aa9bb974 Štěpán Červenka
          "expr": "utcParse(datum.timestamp, '%Y-%m-%d %H:%M:%S%Z')",
34 c2c2ce48 Štěpán Červenka
          "as": "dateTime"
35 8b522708 Štěpán Červenka
        }
36
      ]
37 c2c2ce48 Štěpán Červenka
    },
38
    {
39 8b522708 Štěpán Červenka
      "name": "range",
40 c2c2ce48 Štěpán Červenka
      "source": "table",
41
      "transform": [
42
        {
43
          "type": "aggregate",
44 8b522708 Štěpán Červenka
          "fields": ["dateTime", "dateTime", "value"],
45
          "ops": ["min", "max", "max"],
46
          "as": ["dateMinTemp", "dateMaxTemp", "maxValueTemp"]
47 c2c2ce48 Štěpán Červenka
        },
48
        {
49
          "type": "formula",
50 66c042f1 Štěpán Červenka
          "expr":"time(datum[\"dateMinTemp\"]) - timeWindow",
51 c2c2ce48 Štěpán Červenka
          "as": "dateMin"
52
        },
53
        {
54
          "type": "formula",
55 66c042f1 Štěpán Červenka
          "expr":"time(datum[\"dateMaxTemp\"]) + timeWindow",
56 c2c2ce48 Štěpán Červenka
          "as": "dateMax"
57
        },
58
        {
59
          "type": "formula",
60 72effbbe Štěpán Červenka
          "expr": "datum[\"maxValueTemp\"] * 1.05",
61 8b522708 Štěpán Červenka
          "as": "valueMax"
62 c2c2ce48 Štěpán Červenka
        }
63
      ]
64
    }
65
  ],
66
67
  "signals": [
68
    {
69 8b522708 Štěpán Červenka
      "name": "detailDomain"
70 c2c2ce48 Štěpán Červenka
    }
71 8b522708 Štěpán Červenka
72 c2c2ce48 Štěpán Červenka
  ],
73
74
  "marks": [
75
    {
76
      "type": "group",
77
      "name": "detail",
78
      "encode": {
79
        "enter": {
80 8b522708 Štěpán Červenka
          "height": {"signal": "detailHeight"},
81
          "width": {"signal": "width"}
82 c2c2ce48 Štěpán Červenka
        }
83
      },
84 ec939478 Štěpán Červenka
85 c2c2ce48 Štěpán Červenka
      "scales": [
86
        {
87
          "name": "xDetail",
88
          "type": "time",
89
          "range": "width",
90 66c042f1 Štěpán Červenka
          "domain": {
91
          "data": "range",
92
          "fields": [
93
            "dateMin",
94
            "dateMax"
95
          ]
96
        },
97 8b522708 Štěpán Červenka
          "domainRaw": {"signal": "detailDomain"}
98 c2c2ce48 Štěpán Červenka
        }
99
      ],
100
      "axes": [
101
        {"orient": "bottom", "scale": "xDetail"}
102
      ],
103
      "marks": [
104
        {
105
          "type": "group",
106
          "encode": {
107
            "enter": {
108 8b522708 Štěpán Červenka
              "height": {
109
                "field": {
110
                  "group": "height"
111 c2c2ce48 Štěpán Červenka
                }
112 8b522708 Štěpán Červenka
              },
113
              "width": {
114
                "field": {
115
                  "group": "width"
116
                }
117
              },
118
              "clip": {
119
                "value": true
120 c2c2ce48 Štěpán Červenka
              }
121
            }
122 8b522708 Štěpán Červenka
          }
123 c2c2ce48 Štěpán Červenka
        }
124
      ]
125
    },
126
127
    {
128
      "type": "group",
129
      "name": "overview",
130
      "encode": {
131
        "enter": {
132
          "x": {"value": 0},
133 66c042f1 Štěpán Červenka
          "y": {"signal":  "overviewHeightStart"},
134
          "height": {"signal": "overviewHeight"},
135
          "width": {"signal":  "width"},
136 c2c2ce48 Štěpán Červenka
          "fill": {"value": "transparent"}
137
        }
138
      },
139
      "signals": [
140
        {
141
          "name": "brush",
142
          "on": [
143
            {
144
              "events": {"signal": "delta"},
145
              "update": "clampRange([anchor[0] + delta, anchor[1] + delta], 0, width)"
146
            }
147
          ]
148
        },
149
        {
150
          "name": "anchor", "value": null,
151
          "on": [{"events": "@brush:mousedown", "update": "slice(brush)"}]
152
        },
153
        {
154
          "name": "xdown", "value": 0,
155
          "on": [{"events": "@brush:mousedown", "update": "x()"}]
156
        },
157
        {
158
          "name": "delta", "value": 0,
159
          "on": [
160
            {
161
              "events": "[@brush:mousedown, window:mouseup] > window:mousemove!",
162
              "update": "x() - xdown"
163
            }
164
          ]
165
        },
166
        {
167
          "name": "detailDomain",
168
          "push": "outer",
169
          "on": [
170
            {
171
              "events": {"signal": "brush"},
172 8b522708 Štěpán Červenka
              "update": "span(brush) ? invert('xOverview', brush) : null"
173 c2c2ce48 Štěpán Červenka
            }
174
          ]
175 8b522708 Štěpán Červenka
        }
176
      ],
177 c2c2ce48 Štěpán Červenka
      "scales": [
178
        {
179
          "name": "xOverview",
180
          "type": "time",
181
          "range": "width",
182 8b522708 Štěpán Červenka
          "domain": {"data": "range", "fields": ["dateMin", "dateMax"]}
183 c2c2ce48 Štěpán Červenka
        },
184
        {
185
          "name": "yOverview",
186
          "type": "linear",
187
          "range": [70, 0],
188 8b522708 Štěpán Červenka
          "domain": {"data": "table", "field": "value"},
189 c2c2ce48 Štěpán Červenka
          "nice": true, "zero": true
190
        }
191
      ],
192
      "axes": [
193
        {"orient": "bottom", "scale": "xOverview"}
194
      ],
195
      "marks": [
196
        {
197
          "type": "rect",
198
          "name": "brush",
199
          "encode": {
200
            "enter": {
201
              "y": {"value": 0},
202
              "height": {"value": 70},
203
              "fill": {"value": "#333"},
204
              "fillOpacity": {"value": 0.2}
205
            },
206
            "update": {
207
              "x": {"signal": "brush[0]"},
208
              "x2": {"signal": "brush[1]"}
209
            }
210
          }
211
        },
212
        {
213
          "type": "rect",
214
          "interactive": false,
215
          "encode": {
216
            "enter": {
217
              "y": {"value": 0},
218
              "height": {"value": 70},
219
              "width": {"value": 1},
220
              "fill": {"value": "firebrick"}
221
            },
222
            "update": {
223
              "x": {"signal": "brush[0]"}
224
            }
225
          }
226
        },
227
        {
228
          "type": "rect",
229
          "interactive": false,
230
          "encode": {
231
            "enter": {
232
              "y": {"value": 0},
233
              "height": {"value": 70},
234
              "width": {"value": 1},
235
              "fill": {"value": "firebrick"}
236
            },
237
            "update": {
238
              "x": {"signal": "brush[1]"}
239
            }
240
          }
241
        }
242
      ]
243
    }
244 8b522708 Štěpán Červenka
  ]
245
}
246 c2c2ce48 Štěpán Červenka
247