-
Notifications
You must be signed in to change notification settings - Fork 116
/
dual-axes.py
62 lines (57 loc) · 1.85 KB
/
dual-axes.py
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
from pyg2plot import Plot
data1 = [
{ "time": "2019-03", "value": 350, "type": "uv" },
{ "time": "2019-04", "value": 900, "type": "uv" },
{ "time": "2019-05", "value": 300, "type": "uv" },
{ "time": "2019-06", "value": 450, "type": "uv" },
{ "time": "2019-07", "value": 470, "type": "uv" },
{ "time": "2019-03", "value": 220, "type": "bill" },
{ "time": "2019-04", "value": 300, "type": "bill" },
{ "time": "2019-05", "value": 250, "type": "bill" },
{ "time": "2019-06", "value": 220, "type": "bill" },
{ "time": "2019-07", "value": 362, "type": "bill" },
]
data2 = [
{ "time": "2019-03", "count": 800, "name": "a" },
{ "time": "2019-04", "count": 600, "name": "a" },
{ "time": "2019-05", "count": 400, "name": "a" },
{ "time": "2019-06", "count": 380, "name": "a" },
{ "time": "2019-07", "count": 220, "name": "a" },
{ "time": "2019-03", "count": 750, "name": "b" },
{ "time": "2019-04", "count": 650, "name": "b" },
{ "time": "2019-05", "count": 450, "name": "b" },
{ "time": "2019-06", "count": 400, "name": "b" },
{ "time": "2019-07", "count": 320, "name": "b" },
{ "time": "2019-03", "count": 900, "name": "c" },
{ "time": "2019-04", "count": 600, "name": "c" },
{ "time": "2019-05", "count": 450, "name": "c" },
{ "time": "2019-06", "count": 300, "name": "c" },
{ "time": "2019-07", "count": 200, "name": "c" },
]
dualAxes = Plot("DualAxes")
dualAxes.set_options({
"appendPadding": 32,
"data": [data1, data2],
"xField": "time",
"yField": ["value", "count"],
"legend": {
"position": "top",
},
"geometryOptions": [
{
"geometry": "line",
"seriesField": "type",
"lineStyle": {
"lineWidth": 3,
"lineDash": [5, 5],
},
"smooth": True,
},
{
"geometry": "column",
"seriesField": "name",
"isStack": True,
},
],
})
dualAxes.render("dual-axes.html")