-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathlollipop-2.json
70 lines (65 loc) · 1.73 KB
/
lollipop-2.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/v5.json",
"description": "Standard bar charts display the ranks of values much more easily when sorted into order",
"title": "Lollipop",
"width": 400,
"height": 250,
"padding": 5,
"autosize": {"type": "fit", "contains": "padding"},
"data": [
{
"name": "source",
"url": "./spec/data/ordered-bar.csv",
"format": {"type": "csv", "parse": "auto"}
}
],
"scales": [
{
"name": "yscale",
"type": "band",
"domain": {"data": "source", "field": "Region",
"sort": {"op": "median", "field": "Sales", "order": "descending"}},
"range": "height",
"padding": 0.8,
"round": true
},
{
"name": "xscale",
"domain": {"data": "source", "field": "Sales"},
"nice": true,
"range": "width"
}
],
"axes": [
{ "orient": "bottom", "scale": "xscale", "format": "s", "labelFlush": true, "labelOverlap": true },
{ "orient": "left", "scale": "yscale" }
],
"marks": [
{
"type": "rect",
"from": {"data": "source"},
"encode": {
"enter": {
"y": {"scale": "yscale", "field": "Region"},
"height": {"scale": "yscale", "band": 1},
"x": {"scale": "xscale", "field": "Sales"},
"x2": {"scale": "xscale", "value": 0},
"fill": {"value": "#8f3278"}
}
}
},
{
"type": "symbol",
"from": {"data": "source"},
"encode": {
"enter": {
"y": {"scale": "yscale", "field": "Region", "offset": 4},
"x": {"scale": "xscale", "field": "Sales"},
"size": {"value": 500},
"shape": {"value": "circle"},
"fill": {"value": "#8f3278"}
}
}
}
]
}