Projekt

Obecné

Profil

Stáhnout (5.13 KB) Statistiky
| Větev: | Tag: | Revize:
1 8b522708 Štěpán Červenka
{
2
  "data": [
3 66c042f1 Štěpán Červenka
    {},
4
    {},
5
    {},
6
    {},
7 8b522708 Štěpán Červenka
    {},
8
    {
9 66c042f1 Štěpán Červenka
      "name": "ranks",
10
      "source": "table",
11 8b522708 Štěpán Červenka
      "transform": [
12
        {
13 66c042f1 Štěpán Červenka
          "type": "window",
14
          "sort": {
15
            "field": "dateTime",
16
            "order": "ascending"
17
          },
18
          "ops": [
19
            "rank"
20 8b522708 Štěpán Červenka
          ],
21 66c042f1 Štěpán Červenka
          "fields": [
22
            "value"
23
          ],
24
          "as": [
25
            "rank"
26
          ]
27 8b522708 Štěpán Červenka
        },
28
        {
29
          "type": "formula",
30 66c042f1 Štěpán Červenka
          "expr": "datum.rank + 1",
31
          "as": "nextRank"
32 8b522708 Štěpán Červenka
        },
33
        {
34
          "type": "formula",
35 66c042f1 Štěpán Červenka
          "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 8b522708 Štěpán Červenka
        }
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 66c042f1 Štěpán Červenka
            "fields": [
107
              {"data": "range", "field": "valueMax"},
108
              {"data":  "table", "field": "value"}
109
            ]
110 8b522708 Štěpán Červenka
          },
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 66c042f1 Štěpán Červenka
                "data": "lookup"
129 8b522708 Štěpán Červenka
              },
130
              "encode": {
131
                "enter": {
132
                  "tooltip": {
133 66c042f1 Štěpán Červenka
                    "signal": "{title: timeFormat(datum.dateTime, '%A, %e. %B %Y, %X')  ,  'value': datum.value + 'mm', 'gid': datum.gid }"
134 8b522708 Štěpán Červenka
                  }
135
                },
136
                "update": {
137
                  "x": {
138
                    "scale": "xDetail",
139 66c042f1 Štěpán Červenka
                    "field": "dateStart"
140 8b522708 Štěpán Červenka
                  },
141
                  "x2": {
142
                    "scale": "xDetail",
143 66c042f1 Štěpán Červenka
                    "field": "dateEnd"
144 8b522708 Štěpán Červenka
                  },
145
                  "y": {
146
                    "scale": "yDetail",
147 66c042f1 Štěpán Červenka
                    "field": "value"
148 8b522708 Štěpán Červenka
                  },
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 66c042f1 Štěpán Červenka
      ],
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 8b522708 Štěpán Červenka
      ]
228
    }
229
  ]
230
}