-
Notifications
You must be signed in to change notification settings - Fork 0
/
apitest charts copy.html
173 lines (163 loc) · 4.27 KB
/
apitest charts copy.html
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>ChartCube</title>
<script src="https://gw.alipayobjects.com/os/lib/antv/g2plot/0.11.3/dist/g2plot.js"></script>
</head>
<body>
<div id="app"></div>
<script>
const datav = {
"code": 200,
"success": true,
"data": {
"total": 8,
"records": [
{
"recordId": "recKvb0beKRC5",
"createdAt": 1669791868000,
"updatedAt": 1669796009000,
"fields": {
"审核完成": "12",
"需重报": "33",
"包名": "C03-监测",
"送审中": "60"
}
},
{
"recordId": "reciQW7PHuKns",
"createdAt": 1669791868000,
"updatedAt": 1669796003000,
"fields": {
"审核完成": "14",
"需重报": "12",
"包名": "A01-安徽宏志",
"送审中": "45"
}
},
{
"recordId": "recH557rr3Z5a",
"createdAt": 1669791868000,
"updatedAt": 1669796001000,
"fields": {
"审核完成": "16",
"需重报": "12",
"包名": "A02-安徽地质",
"送审中": "12"
}
},
{
"recordId": "reczDqq51K2Ao",
"createdAt": 1669791868000,
"updatedAt": 1669791868000,
"fields": {
"审核完成": "90",
"需重报": "3",
"包名": "A03-一局发展",
"送审中": "81"
}
},
{
"recordId": "rece7EAvjEnq6",
"createdAt": 1669791868000,
"updatedAt": 1669791868000,
"fields": {
"审核完成": "36",
"需重报": "2",
"包名": "F18-奥加诺",
"送审中": "67"
}
},
{
"recordId": "recqrJ7utt20J",
"createdAt": 1669791868000,
"updatedAt": 1669792408000,
"fields": {
"审核完成": "6",
"需重报": "4",
"包名": "F21-固达利",
"送审中": "12"
}
},
{
"recordId": "recU2lQm53AK7",
"createdAt": 1669791868000,
"updatedAt": 1669791868000,
"fields": {
"审核完成": "23",
"需重报": "3",
"包名": "F22-鑫华夏",
"送审中": "34"
}
},
{
"recordId": "recQa6hw2ooF4",
"createdAt": 1669791868000,
"updatedAt": 1669791868000,
"fields": {
"审核完成": "12",
"需重报": "2",
"包名": "F17-上海野村",
"送审中": "12"
}
}
],
"pageNum": 1,
"pageSize": 8
},
"message": "SUCCESS"
};
const firstRecord = apiResponse.data.records[0];
const 审核完成 = firstRecord.fields.审核完成;
const 送审中 = firstRecord.fields['送审中'];
console.log(审核完成); // "12"
console.log(送审中); // "60"
const container = document.getElementById('app');
const config = {
"title": {
"visible": true,
"text": "分组柱状图"
},
"description": {
"visible": true,
"text": "一个简单的分组柱状图"
},
"legend": {
"flipPage": false
},
"xAxis": {
"title": {
"visible": false
}
},
"yAxis": {
"title": {
"visible": false
}
},
"label": {
"visible": true
},
"forceFit": false,
"width": 480,
"height": 480,
"xField": "包名",
"yField": "送审中",
"groupField": "需重报",
"columnSize": null,
"color": [
"#5B8FF9",
"#5AD8A6"
]
}
const plot = new g2plot.GroupColumn(container, {
datav,
...config,
});
plot.render();
</script>
</body>
</html>