-
Notifications
You must be signed in to change notification settings - Fork 590
/
circle_custom_tick_labels.vg.json
111 lines (111 loc) · 2.69 KB
/
circle_custom_tick_labels.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/v5.json",
"background": "white",
"padding": 5,
"width": 200,
"style": "cell",
"data": [
{"name": "source_0", "url": "data/movies.json", "format": {"type": "json"}},
{
"name": "data_0",
"source": "source_0",
"transform": [
{
"type": "aggregate",
"groupby": ["Major Genre"],
"ops": ["mean"],
"fields": ["IMDB Rating"],
"as": ["mean_IMDB Rating"]
},
{
"type": "filter",
"expr": "isValid(datum[\"mean_IMDB Rating\"]) && isFinite(+datum[\"mean_IMDB Rating\"])"
}
]
}
],
"signals": [
{"name": "y_step", "value": 20},
{
"name": "height",
"update": "bandspace(domain('y').length, 1, 0.5) * y_step"
}
],
"marks": [
{
"name": "marks",
"type": "symbol",
"style": ["circle"],
"from": {"data": "data_0"},
"encode": {
"update": {
"size": {"value": 80},
"fill": {"value": "#4c78a8"},
"ariaRoleDescription": {"value": "circle"},
"description": {
"signal": "\"Mean of IMDB Rating: \" + (format(datum[\"mean_IMDB Rating\"], \"\")) + \"; Major Genre: \" + (isValid(datum[\"Major Genre\"]) ? datum[\"Major Genre\"] : \"\"+datum[\"Major Genre\"])"
},
"x": {"scale": "x", "field": "mean_IMDB Rating"},
"y": {"scale": "y", "field": "Major Genre"},
"shape": {"value": "circle"}
}
}
}
],
"scales": [
{
"name": "x",
"type": "linear",
"domain": [0, 10],
"range": [0, {"signal": "width"}],
"nice": true,
"zero": true
},
{
"name": "y",
"type": "point",
"domain": {
"data": "source_0",
"field": "Major Genre",
"sort": {"op": "mean", "field": "IMDB Rating"}
},
"range": {"step": {"signal": "y_step"}},
"padding": 0.5
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"values": [0, 5, 10],
"gridScale": "y",
"grid": true,
"domain": false,
"labels": false,
"aria": false,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"scale": "x",
"orient": "bottom",
"grid": false,
"labelFlush": false,
"values": [0, 5, 10],
"labelOverlap": true,
"encode": {
"labels": {
"update": {
"text": {
"signal": "datum.label == 0 ? 'Poor' : datum.label == 5 ? 'Neutral' : 'Great'"
}
}
}
},
"zindex": 0
},
{"scale": "y", "orient": "left", "grid": false, "zindex": 0}
]
}