-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.html
executable file
·205 lines (195 loc) · 7.19 KB
/
demo.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
<html>
<head>
<meta charset="utf-8">
<script src="echarts.js"></script>
<!-- <script src="lib/config.js"></script> -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<style>
/*html, body{
width: 500px;
height: 300px;
margin: 0 auto;
/*margin-top: 100px;*/
/*background-color:#0092B4;*/
.contain {
/*background-color: black;*/
width: 800px;
height: 500px;
background-image:url(./img/beijing.jpg);
background-repeat:no-repeat;
}
.panel {
background-image:url(./img/background.png);
background-repeat:no-repeat;
/*margin-top: 100px;*/
background-position:50% 98%;
background-size:500px 300px;
/*padding-top: 10px;*/
/*position: relative;*/
/*width: 500px;
height: 500px;*/
}
#main {
width: 500px;
height: 300px;
margin: 0 auto;
padding-top: 100px;
}
.topl{
position: absolute;
width: 20px;
height: 20px;
top: 104px;
left: 156px;
}
.topr{
position: absolute;
width: 20px;
height: 20px;
top: 104px;
left: 640px;
}
.bottl{
position: absolute;
width: 20px;
height: 20px;
top: 388px;
left: 156px;
}
.bottr{
position: absolute;
width: 20px;
height: 20px;
top: 388px;
left: 640px;
}
.text {
color: #07C5F1;
position: absolute;
top: 50px;
left: 152px;
}
</style>
<div class='contain'>
<p class="text">动态数据显示</p>
<div class="panel">
<img class="topl" src="./img/1.png">
<img class="topr" src="./img/2.png">
<div id="main"></div>
<img class="bottl" src="./img/3.png">
<img class="bottr" src="./img/4.png">
</div>
</div>
<script>
var chart = echarts.init(document.getElementById('main'));
chart.setOption(
{
backgroundColor: 'transparent',
// backgroundColor:'transparent',
legend: {
bottom: 10,
textStyle:{
color:'#fff',
},
// data: ['数据项']
},
grid: {
left: '3%',
right: '4%',
bottom: '10%',
containLabel: true
},
tooltip: {
show:"true",
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
xAxis: {
type: 'value',
axisTick : {show: false},
axisLine: {
show: false,
lineStyle:{
color:'#fff',
}
},
axisLabel:{
show: false,
// formatter: function(){
// return "";
// }
},
splitLine: {
show: true,
lineStyle:{
type: 'dashed',
color:'rgba(7,197,241,0.3)'
}
},
},
yAxis: [
{
type: 'category',
axisTick : {show: false},
axisLine: {
show: true,
lineStyle:{
color:'#fff',
}
},
data: ['数据5','数据4','数据3','数据2','数据1']
}
],
series: [
{
name: '数据项',
type: 'bar',
yAxisIndex:0,
itemStyle:{
normal: {
show: true,
color: function(params){
if(params.dataIndex%2 === 0){
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
offset: 0,
color: '#0081D5'
}, {
offset: 0.7,
color: '#33D5B0'},
])
} else {
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
offset: 0,
color: '#0081D5'
},
{
offset: 0.8,
color: '#A133D5'}
])
}
},
barBorderRadius:50,
borderWidth:0,
borderColor:'#333',
label: {
show: true,
position: 'right',
color:'#07C5F1',
formatter: '{c}%'
}
}
},
barGap:'0%',
barCategoryGap:'50%',
data: [86, 75, 53, 75, 93]
}
]
});
window.onresize = chart.resize;
</script>
</body>
</html>