1
|
{
|
2
|
"$schema": "https://vega.github.io/schema/vega/v5.json",
|
3
|
"width": 400,
|
4
|
"height": 200,
|
5
|
"padding": 5,
|
6
|
|
7
|
"data": [
|
8
|
{
|
9
|
"name": "table",
|
10
|
"values": [
|
11
|
{"category": "A", "amount": 28},
|
12
|
{"category": "B", "amount": 55},
|
13
|
{"category": "C", "amount": 43},
|
14
|
{"category": "D", "amount": 91},
|
15
|
{"category": "E", "amount": 81},
|
16
|
{"category": "F", "amount": 53},
|
17
|
{"category": "G", "amount": 19},
|
18
|
{"category": "H", "amount": 87}
|
19
|
]
|
20
|
}
|
21
|
],
|
22
|
|
23
|
"scales": [
|
24
|
{
|
25
|
"name": "xscale",
|
26
|
"type": "point",
|
27
|
"domain": {"data": "table", "field": "category"},
|
28
|
"range": "width"
|
29
|
},
|
30
|
{
|
31
|
"name": "yscale",
|
32
|
"type": "linear",
|
33
|
"domain": {"data": "table", "field": "amount"},
|
34
|
"nice": true,
|
35
|
"range": "height"
|
36
|
}
|
37
|
],
|
38
|
|
39
|
"axes": [
|
40
|
{ "orient": "bottom", "scale": "xscale" },
|
41
|
{ "orient": "left", "scale": "yscale" }
|
42
|
],
|
43
|
|
44
|
"marks": [
|
45
|
{
|
46
|
"type": "line",
|
47
|
"from": {"data":"table"},
|
48
|
"encode": {
|
49
|
"enter": {
|
50
|
|
51
|
"x": {"scale" : "xscale", "field": "category"},
|
52
|
"y": {"scale" : "yscale", "field": "amount"}
|
53
|
},
|
54
|
"update": {
|
55
|
"stroke": {"value": "steelblue"},
|
56
|
"strokeWidth": {"value": 3}
|
57
|
},
|
58
|
"hover": {
|
59
|
"stroke": {"value": "red"},
|
60
|
"strokeWidth": {"value": 5}
|
61
|
}
|
62
|
}
|
63
|
}
|
64
|
]
|
65
|
}
|