This repository has been archived by the owner on Jul 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
label_rect_stack.vg.json
111 lines (107 loc) · 2.54 KB
/
label_rect_stack.vg.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
"$schema": "https://vega.github.io/schema/vega/v4.json",
"width": 500,
"height": 200,
"padding": 5,
"data": [
{
"name": "table",
"values": [
{"x": 0, "y": 28, "c": 0},
{"x": 0, "y": 55, "c": 1},
{"x": 1, "y": 43, "c": 0},
{"x": 1, "y": 91, "c": 1},
{"x": 2, "y": 81, "c": 0},
{"x": 2, "y": 53, "c": 1},
{"x": 3, "y": 19, "c": 0},
{"x": 3, "y": 87, "c": 1},
{"x": 4, "y": 52, "c": 0},
{"x": 4, "y": 48, "c": 1},
{"x": 5, "y": 24, "c": 0},
{"x": 5, "y": 49, "c": 1},
{"x": 6, "y": 87, "c": 0},
{"x": 6, "y": 66, "c": 1},
{"x": 7, "y": 17, "c": 0},
{"x": 7, "y": 27, "c": 1},
{"x": 8, "y": 68, "c": 0},
{"x": 8, "y": 16, "c": 1},
{"x": 9, "y": 49, "c": 0},
{"x": 9, "y": 15, "c": 1}
],
"transform": [
{
"type": "stack",
"groupby": ["x"],
"sort": {"field": "c"},
"field": "y"
}
]
}
],
"scales": [
{
"name": "x",
"type": "band",
"range": "width",
"domain": {"data": "table", "field": "x"}
},
{
"name": "y",
"type": "linear",
"range": "height",
"nice": true,
"zero": true,
"domain": [0, 180]
},
{
"name": "color",
"type": "ordinal",
"range": "category",
"domain": {"data": "table", "field": "c"}
}
],
"axes": [{"orient": "bottom", "scale": "x", "zindex": 1}, {"orient": "left", "scale": "y", "zindex": 1}],
"marks": [
{
"type": "rect",
"name": "baseRect",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "x", "field": "x"},
"width": {"scale": "x", "band": 1, "offset": -1},
"y": {"scale": "y", "field": "y0"},
"y2": {"scale": "y", "field": "y1"},
"fill": {"scale": "color", "field": "c"}
},
"update": {
"fillOpacity": {"value": 1}
},
"hover": {
"fillOpacity": {"value": 0.5}
}
}
},
{
"type": "text",
"from": {"data": "baseRect"},
"encode": {
"enter": {
"x": {"field": "x"},
"y": {"field": "y"},
"text": {"field": "datum.y"},
"fontSize": {"value": 15},
"fill": {"value": "#fff"}
}
},
"transform": [
{
"type": "label",
"size": [500, 200],
"anchor": "top",
"offset": -8
}
]
}
]
}