aswi2021codebakers-gitlab/src/vega/body/barchart.json @ 8cca41c0
1 |
{
|
---|---|
2 |
"data": [ |
3 |
{}, |
4 |
{ |
5 |
"transform": [ |
6 |
{}, |
7 |
{}, |
8 |
{}, |
9 |
{}, |
10 |
{ |
11 |
"type": "timeunit", |
12 |
"field": "dateTime", |
13 |
"units": [ |
14 |
"year", |
15 |
"month", |
16 |
"date", |
17 |
"hours", |
18 |
"minutes", |
19 |
"seconds" |
20 |
], |
21 |
"step": { |
22 |
"signal": "timeStep" |
23 |
} |
24 |
}, |
25 |
{ |
26 |
"type": "formula", |
27 |
"expr": "time(datum[\"unit0\"] + (timeStep * 100))", |
28 |
"as": "barStart" |
29 |
}, |
30 |
{ |
31 |
"type": "formula", |
32 |
"expr": "time(datum[\"unit1\"] - (timeStep * 100))", |
33 |
"as": "barEnd" |
34 |
} |
35 |
] |
36 |
} |
37 |
], |
38 |
"marks": [ |
39 |
{ |
40 |
"scales": [ |
41 |
{}, |
42 |
{ |
43 |
"name": "yDetail", |
44 |
"type": "linear", |
45 |
"range": [ |
46 |
390, |
47 |
0 |
48 |
], |
49 |
"domain": { |
50 |
"data": "table", |
51 |
"field": "value" |
52 |
}, |
53 |
"nice": true, |
54 |
"zero": true |
55 |
} |
56 |
], |
57 |
"axes": [ |
58 |
{}, |
59 |
{ |
60 |
"orient": "left", |
61 |
"scale": "yDetail" |
62 |
} |
63 |
], |
64 |
"marks": [ |
65 |
{ |
66 |
"marks": [ |
67 |
{ |
68 |
"type": "rect", |
69 |
"from": { |
70 |
"data": "table" |
71 |
}, |
72 |
"encode": { |
73 |
"enter": { |
74 |
"tooltip": { |
75 |
"signal": "{title: timeFormat(datum.dateTime, '%A, %e. %B %Y, %X') }" |
76 |
} |
77 |
}, |
78 |
"update": { |
79 |
"x": { |
80 |
"scale": "xDetail", |
81 |
"field": "barStart" |
82 |
}, |
83 |
"x2": { |
84 |
"scale": "xDetail", |
85 |
"field": "barEnd" |
86 |
}, |
87 |
"y": { |
88 |
"scale": "yDetail", |
89 |
"field": "avg" |
90 |
}, |
91 |
"y2": { |
92 |
"scale": "yDetail", |
93 |
"value": 0 |
94 |
}, |
95 |
"color": { |
96 |
"value": "both" |
97 |
}, |
98 |
"fill": { |
99 |
"value": "steelBlue" |
100 |
} |
101 |
}, |
102 |
"hover": { |
103 |
"fill": { |
104 |
"value": "red" |
105 |
}, |
106 |
"size": { |
107 |
"value": 60 |
108 |
} |
109 |
} |
110 |
} |
111 |
} |
112 |
] |
113 |
} |
114 |
] |
115 |
}, |
116 |
{ |
117 |
"signals": [ |
118 |
{ |
119 |
"value": 0, |
120 |
"on": [ |
121 |
{}, |
122 |
{ |
123 |
"events": "@overview:mousedown", |
124 |
"update": "[x(), x()]" |
125 |
}, |
126 |
{ |
127 |
"events": "[@overview:mousedown, window:mouseup] > window:mousemove!", |
128 |
"update": "[brush[0], clamp(x(), 0, width)]" |
129 |
} |
130 |
] |
131 |
} |
132 |
] |
133 |
} |
134 |
] |
135 |
}
|