-
Notifications
You must be signed in to change notification settings - Fork 592
/
bar_heatlane_normalized.vl.json
70 lines (70 loc) · 2 KB
/
bar_heatlane_normalized.vl.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Heat lane chart based on https://www.smashingmagazine.com/2022/07/accessibility-first-approach-chart-visual-design/",
"data": {"url": "data/cars.json"},
"height": 150,
"width": 400,
"title": "Heat Lane of Horsepower",
"layer": [
{
"mark": {"type": "bar", "xOffset": 2, "x2Offset": -2, "cornerRadius": 3},
"encoding": {
"x": {
"field": "bin_Horsepower_start",
"type": "quantitative",
"title": "Horsepower",
"axis": {"grid": false}
},
"x2": {"field": "bin_Horsepower_end"},
"y": {"field": "y", "axis": null},
"y2": {"field": "y2"},
"color": {
"field": "max_bin_count_end",
"type": "ordinal",
"title": "count",
"scale": {"scheme": "lighttealblue"}
}
}
},
{
"mark": {
"type": "bar",
"xOffset": 2,
"x2Offset": -2,
"yOffset": -3,
"y2Offset": 3
},
"encoding": {
"x": {
"field": "bin_Horsepower_start",
"type": "quantitative",
"title": "Horsepower",
"axis": {"grid": false}
},
"x2": {"field": "bin_Horsepower_end"},
"y": {"field": "y", "axis": null},
"y2": {"field": "y2"},
"color": {"field": "bin_count_end", "type": "ordinal", "title": "count"}
}
}
],
"transform": [
{
"bin": true,
"field": "Horsepower",
"as": ["bin_Horsepower_start", "bin_Horsepower_end"]
},
{
"aggregate": [{"op": "count", "as": "count"}],
"groupby": ["bin_Horsepower_start", "bin_Horsepower_end"]
},
{"bin": true, "field": "count", "as": ["bin_count_start", "bin_count_end"]},
{"calculate": "-datum.bin_count_end/2", "as": "y2"},
{"calculate": "datum.bin_count_end/2", "as": "y"},
{
"joinaggregate": [
{"field": "bin_count_end", "op": "max", "as": "max_bin_count_end"}
]
}
]
}