Revize 66c042f1
Přidáno uživatelem Štěpán Červenka před více než 3 roky(ů)
src/vega/body/barchart.json | ||
---|---|---|
1 | 1 |
{ |
2 | 2 |
"data": [ |
3 |
{}, |
|
4 |
{}, |
|
5 |
{}, |
|
6 |
{}, |
|
3 | 7 |
{}, |
4 | 8 |
{ |
9 |
"name": "ranks", |
|
10 |
"source": "table", |
|
5 | 11 |
"transform": [ |
6 |
{}, |
|
7 |
{}, |
|
8 |
{}, |
|
9 |
{}, |
|
10 | 12 |
{ |
11 |
"type": "timeunit", |
|
12 |
"field": "dateTime", |
|
13 |
"units": [ |
|
14 |
"year", |
|
15 |
"month", |
|
16 |
"date", |
|
17 |
"hours", |
|
18 |
"minutes", |
|
19 |
"seconds" |
|
13 |
"type": "window", |
|
14 |
"sort": { |
|
15 |
"field": "dateTime", |
|
16 |
"order": "ascending" |
|
17 |
}, |
|
18 |
"ops": [ |
|
19 |
"rank" |
|
20 | 20 |
], |
21 |
"step": { |
|
22 |
"signal": "timeStep" |
|
23 |
} |
|
21 |
"fields": [ |
|
22 |
"value" |
|
23 |
], |
|
24 |
"as": [ |
|
25 |
"rank" |
|
26 |
] |
|
24 | 27 |
}, |
25 | 28 |
{ |
26 | 29 |
"type": "formula", |
27 |
"expr": "time(datum[\"unit0\"] + (timeStep * 100))",
|
|
28 |
"as": "barStart"
|
|
30 |
"expr": "datum.rank + 1",
|
|
31 |
"as": "nextRank"
|
|
29 | 32 |
}, |
30 | 33 |
{ |
31 | 34 |
"type": "formula", |
32 |
"expr": "time(datum[\"unit1\"] - (timeStep * 100))", |
|
33 |
"as": "barEnd" |
|
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" |
|
34 | 90 |
} |
35 | 91 |
] |
36 | 92 |
} |
... | ... | |
47 | 103 |
0 |
48 | 104 |
], |
49 | 105 |
"domain": { |
50 |
"data": "table", |
|
51 |
"field": "value" |
|
106 |
"fields": [ |
|
107 |
{"data": "range", "field": "valueMax"}, |
|
108 |
{"data": "table", "field": "value"} |
|
109 |
] |
|
52 | 110 |
}, |
53 | 111 |
"nice": true, |
54 | 112 |
"zero": true |
... | ... | |
67 | 125 |
{ |
68 | 126 |
"type": "rect", |
69 | 127 |
"from": { |
70 |
"data": "table"
|
|
128 |
"data": "lookup"
|
|
71 | 129 |
}, |
72 | 130 |
"encode": { |
73 | 131 |
"enter": { |
74 | 132 |
"tooltip": { |
75 |
"signal": "{title: timeFormat(datum.dateTime, '%A, %e. %B %Y, %X') }" |
|
133 |
"signal": "{title: timeFormat(datum.dateTime, '%A, %e. %B %Y, %X') , 'value': datum.value + 'mm', 'gid': datum.gid }"
|
|
76 | 134 |
} |
77 | 135 |
}, |
78 | 136 |
"update": { |
79 | 137 |
"x": { |
80 | 138 |
"scale": "xDetail", |
81 |
"field": "barStart"
|
|
139 |
"field": "dateStart"
|
|
82 | 140 |
}, |
83 | 141 |
"x2": { |
84 | 142 |
"scale": "xDetail", |
85 |
"field": "barEnd"
|
|
143 |
"field": "dateEnd"
|
|
86 | 144 |
}, |
87 | 145 |
"y": { |
88 | 146 |
"scale": "yDetail", |
89 |
"field": "avg"
|
|
147 |
"field": "value"
|
|
90 | 148 |
}, |
91 | 149 |
"y2": { |
92 | 150 |
"scale": "yDetail", |
... | ... | |
129 | 187 |
} |
130 | 188 |
] |
131 | 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 |
} |
|
132 | 227 |
] |
133 | 228 |
} |
134 | 229 |
] |
Také k dispozici: Unified diff
Re #8775 - Agregovat grafy se stejným typem sensoru