Projekt

Obecné

Profil

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