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