-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.html
More file actions
206 lines (201 loc) · 8.59 KB
/
demo.html
File metadata and controls
206 lines (201 loc) · 8.59 KB
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
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- Step1 -->
<script src="js/esl.js" type="text/javascript"></script>
</head>
<body>
<!-- Step2: Prepare a Dom which must have width and height -->
<div>
<div id="main" style="height:400px; width:1000px; 1px solid #ccc; padding: 10px;"></div>
<div id="main2" style="height:400px; width:1000px; 1px solid #ccc; padding: 10px;"></div>
</div>
<script type="text/javascript" language="javascript">
require.config({
paths:{
'echarts' : './js/echarts',
'echarts/chart/bar' : '.js/echarts',
'echarts/chart/line' : '.js/echarts',
'echarts/chart/pie' : '.js/echarts'
}
});
require(
[
'echarts',
'echarts/chart/bar',
'echarts/chart/line',
'echarts/chart/pie'
],
function(ec) {
var myChart = ec.init(document.getElementById('main'));
var option = {
title : {
subtext: 'Data from UN',
sublink: 'http://esa.un.org/wpp/Excel-Data/population.htm',
x: 'center',
y: 'bottom'
},
tooltip : {
trigger: 'axis'
},
toolbox: {
show : true,
y: 'bottom',
feature : {
dataView : {show: true, title:'data view',readOnly: false},
magicType : {show: true, title:{line:'line',bar:'bar',stack:'stack',tile:'tiled'},type: ['line', 'bar', 'stack', 'tiled']},
restore : {show: true,title:'restore'},
saveAsImage : {show: true,title:'save as image'}
}
},
calculable : true,
legend: {
data:['Africa','Asia','Europe','Latin America','Northern America','Oceania']
},
xAxis : [
{
type : 'category',
splitLine : {show : false},
data : ['2005','2006','2007','2008','2009','2010']
}
],
yAxis : [
{
type : 'value',
position: 'right',
splitArea : {show: true}
}
],
series : [
{
name:'Africa',
type:'bar',
data:[911528,934079,957318,981243,1005838,1031084]
},
{
name:'Asia',
type:'bar',
data:[3942882,3987509,4032014,4076463,4120930,4165440]
},
{
name:'Europe',
type:'bar',
data:[732970,734361,735929,737546,739047,740308]
},
{
name:'Latin America',
type:'bar',
data:[562546,569400,576136,582806,589476,596191]
},
{
name:'Northern America',
type:'bar',
data:[330546,333681,336900,340154,343372,346501]
},
{
name:'Oceania',
type:'bar',
data:[33623,34198,34808,35437,36059,36659]
},
{
name:'World',
type:'line',
data:[6514095,6593228,6673106,6753649,6834722,6916183]
}
]
};
myChart.setOption(option);
}
);
</script>
<script type="text/javascript" language="javascript">
require.config({
paths:{
'echarts' : './js/echarts',
'echarts/chart/bar' : '.js/echarts',
'echarts/chart/line' : '.js/echarts',
'echarts/chart/pie' : '.js/echarts'
}
});
require(
[
'echarts',
'echarts/chart/bar',
'echarts/chart/line',
'echarts/chart/pie'
],
function(ec2) {
var myChart2 = ec2.init(document.getElementById('main2'));
var option2 = {
calculable : true,
tooltip : {
trigger: 'axis'
},
toolbox: {
show : true,
y: 'bottom',
feature : {
dataView : {show: true, title:'data view',readOnly: false},
restore : {show: true,title:'restore'},
saveAsImage : {show: true,title:'save as image'}
}
},
yAxis : [
{
type : 'value',
position: 'right',
splitArea : {show: true}
}
],
series : [
{
name:'World Population 2010',
type:'pie',
tooltip : {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
center: [400,220],
radius : [0, 60],
startAngle: 55,
itemStyle : {
normal : {
labelLine : {
length : 20
}
}
},
data:[
{value:342595, name:'Eastern Africa'},
{value:124978, name:'Middle Africa'},
{value:199620, name:'Northern Africa'},
{value:58803, name:'Southern Africa'},
{value:305088, name:'Western Africa'},
{value:1593571, name:'Eastern Asia'},
{value:1743101, name:'South-Central Asia'},
{value:61694, name:'Central Asia'},
{value:1681407, name:'Southern Asia'},
{value:597097, name:'South-Eastern Asia'},
{value:231671, name:'Western Asia'},
{value:296183, name:'Eastern Europe'},
{value:98795, name:'Northern Europe'},
{value:154712, name:'Southern Europe'},
{value:190618, name:'Western Europe'},
{value:41625, name:'Caribbean'},
{value:160546, name:'Central America'},
{value:394021, name:'South America'},
{value:346501, name:'Northern America'},
{value:26773, name:'Australia/NewZealand'},
{value:8729, name:'Melanesia'},
{value:498, name:'Micronesia'},
{value:660, name:'Polynesia'},
]
}
]
};
myChart2.setOption(option2);
}
);
</script>
</body>