-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
283 lines (267 loc) · 9.17 KB
/
index.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!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>Document</title>
<link rel="stylesheet" href="./index.css">
<script src="https://cdn.bootcss.com/echarts/4.4.0-rc.1/echarts-en.common.min.js"></script>
<script src="https://cdn.bootcss.com/axios/0.19.0-beta.1/axios.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<header>
<div class="nav">
<div class="logo">LOGO</div>
<div class="right">
<i><img src="./images/settings.png" alt=""></i>
<i><img src="./images/bell.png" alt=""></i>
<div class="logout">Log Out</div>
</div>
</div>
</header>
<div class="navlist">
<div class="left">
<p>Audience Overview</p>
<p>Roseville CA</p>
</div>
<div class="right">
<ul>
<li class="bd-bottom">DASHBOARD</li>
<li>PROJECTS</li>
<li>CALENDAR</li>
<li>MAILBOX</li>
<li>SETTINGS</li>
</ul>
</div>
</div>
<div class="echarts">
<div class="ech_left">
<div id="banner">
<div class="pic">
<div class="picImg"><img src="./images/pro1.jpg" width="520" height="280" alt="" /></div>
<div class="picImg"><img src="./images/pro2.jpg" width="520" height="280" alt="" /></div>
<div class="picImg"><img src="./images/pro3.jpg" width="520" height="280" alt="" /></div>
<div class="picImg"><img src="./images/pro4.jpg" width="520" height="280" alt="" /></div>
<div class="picImg"><img src="./images/pro5.jpg" width="520" height="280" alt="" /></div>
</div>
<ul class="tabs">
<li class="bg"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<div class="btn btn1"><</div>
<div class="btn btn2">></div>
</div>
</div>
<div class="ech_right">
<div class="right_head">
<p>support Requests</p>
<div class="view">View All</div>
</div>
<div class="right_bott">
<div class="time">
<h3>TIME</h3>
<P>9:45pm</P>
<P>9:45pm</P>
</div>
<div class="username">
<h3>USER NAME</h3>
<P>[email protected]</P>
<P>[email protected]</P>
</div>
<div class="status">
<h3>STATUS</h3>
<div class="solved">solved</div>
<div class="solved">solved</div>
</div>
</div>
</div>
</div>
<div class="ech_data">
<div class="data_top">
<h3>曲线图数据显示</h3>
<div id="line" style="width: 1100px;height: 300px;margin: 0 auto;"></div>
</div>
<div class="data_left">
<h3>饼状图数据展示</h3>
<div id="pie" style="width: 560px;height: 300px;margin: 0 auto;"></div>
</div>
<div class="data_right">
<h3>柱状图数据展示</h3>
<div id="column" style="width: 560px;height: 300px;margin: 0 auto;"></div>
</div>
</div>
<footer>
<div class="fbox">
<div class="foot_left">
<div class="foot_logo">LOGO</div>
</div>
<div class="foot_right">
<div class="footbox">
<p>NEWS</p>
<p>CHANNELS</p>
<p>OVERVIEW</p>
<p>TIMELINE</p>
</div>
<div class="footbox">
<p>SPORT</p>
<p>CULTURE</p>
<p>NATURE</p>
<p>MUSIC</p>
</div>
<div class="footbox">
<p>WEATHER</p>
<p>AUTOS</p>
<p>LOCAL</p>
<p>SHOP</p>
</div>
<div class="footbox">
<p>FUTURE</p>
<p>FOOD</p>
<p>EARTH</p>
<p>TV</p>
</div>
<div class="footbox">
<p>TRAVEL</p>
<p>RADIO</p>
</div>
</div>
</div>
</footer>
</body>
<script src="./js//script.js"></script>
<script>
window.onload = function() {
//封装请求数据方法
function getData(url, params) {
return new Promise((resolve, reject) => {
axios.get(url, {
params: params
}).then(res => {
resolve(res.data);
}).catch(err => {
reject(err.data)
})
});
}
//曲线图
var lineChart = echarts.init(document.getElementById('line'));
getData('https://edu.telking.com/api/?type=month').then(res => {
console.log(res.data.series);
lineChart.setOption({
xAxis: {
type: 'category',
data: res.data.xAxis,
axisLine: {
lineStyle: {
type: 'dashed',
width: 1
}
},
},
yAxis: {
type: 'value',
axisLine: {
lineStyle: {
type: 'dashed',
}
}
},
series: [{
data: res.data.series,
type: 'line',
smooth: true,
lineStyle: {
normal: {
color: '#4d8aee',
type: 'solid'
}
},
areaStyle: {
color: '#f3f6fe'
},
itemStyle: {
normal: {
// 拐点上显示数值
label: {
show: true,
color: '#4d8aee'
},
borderColor: '#4d8aee', // 拐点边框颜色
lineStyle: {
width: 2, // 设置线宽
type: 'solid' //'dotted'虚线 'solid'实线
}
}
}
}]
});
})
//饼状图
var myChart = echarts.init(document.getElementById('pie'));
getData('https://edu.telking.com/api/?type=week').then(res => {
const seriesData = res.data.xAxis.map((ret, index) => {
return {
name: ret,
value: res.data.series[index]
}
})
// console.log(seriesData);
myChart.setOption({
series: [{
type: "pie",
data: seriesData
}]
});
})
//柱状图
var columnChart = echarts.init(document.getElementById('column'));
getData('https://edu.telking.com/api/?type=week').then(res => {
console.log(res)
columnChart.setOption({
title: {
text: "商品数",
textStyle: {
fontSize: 14
},
padding: [33, 10, 10, 22]
},
color: ['#4587f0'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [{
type: 'category',
data: res.data.xAxis,
axisTick: {
alignWithLabel: true
}
}],
yAxis: [{
type: 'value'
}],
series: [{
name: '直接访问',
type: 'bar',
barWidth: '30%',
data: res.data.series
}]
});
})
columnChart.setOption(option);
}
</script>
</html>