forked from apache/echarts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-en.html
310 lines (280 loc) · 11 KB
/
start-en.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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ECharts">
<meta name="author" content="kener.linfeng@gmail.com">
<title>ECharts · Start</title>
<link rel="shortcut icon" href="./asset/ico/favicon.png">
<link href="./asset/css/font-awesome.min.css" rel="stylesheet">
<link href="./asset/css/bootstrap.css" rel="stylesheet">
<link href="./asset/css/carousel.css" rel="stylesheet">
<link href="./asset/css/echartsHome.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="./asset/js/google-code-prettify.js"></script>
<link href="./asset/css/google-code-prettify.css" rel="stylesheet" />
<link href="./asset/css/monokai.css" rel="stylesheet">
<style type="text/css">
.nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover {
background-color:rgb(247, 247, 247);
font-weight: bolder;
}
.tab-content {
padding:20px;
border-left: 1px solid #dddddd;
border-right: 1px solid #dddddd;
border-top: 0px;
}
</style>
</head>
<body onload="prettyPrint()">
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
<div class="container">
<h2 class="text-center">5 minutes to your first chart</h2>
<ul class="nav nav-tabs nav-justified">
<li class="active">
<a id = "o-aqi" href="#main0" data-toggle="tab">modular single file import (preferred)</a></li>
<li><a id = "o-pm25" href="#main1" data-toggle="tab">plain single file import</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="main0">
<b class="title">1, Creat a echarts.html file. Prepare a Dom with size (width and height) for ECharts.</b>
<pre class="prettyprint"><xmp><!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!-- Prepare a Dom with size (width and height) for ECharts -->
<div id="main" style="height:400px"></div>
</body></xmp></pre>
<b class="title">2, Create a < script > tag to include echarts' core file, echarts.js. </ b></b>
<pre class="prettyprint"><xmp><!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!-- Prepare a Dom with size (width and height) for ECharts -->
<div id="main" style="height:400px"></div>
<!-- ECharts import -->
<script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
</body></xmp></pre>
<b class="title">3, Create a new < script > tag, configure for module loader a path of echarts and the chart you need (the relative path is to link from the current page to echarts.js). For imported chart file, refer to <a href="doc-en.html#Import-ECharts2" target="_blank">Import ECharts2</a></b>
<pre class="prettyprint"><xmp><!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!-- Prepare a Dom with size (width and height) for ECharts -->
<div id="main" style="height:400px"></div>
<!-- ECharts import -->
<script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
<script type="text/javascript">
// configure for module loader
require.config({
paths: {
echarts: 'http://echarts.baidu.com/build/dist'
}
});
</script>
</body></xmp></pre>
<b class="title">4, Dynamically load echarts and the chart you need in the < script > tag. Use callback function to initialize and drive the generation of charts. For option, refer to <a href="doc-en.html#Option" target="_blank">API & Doc</a></b>
<pre class="prettyprint"><xmp><!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!-- Prepare a Dom with size (width and height) for ECharts -->
<div id="main" style="height:400px"></div>
<!-- ECharts import -->
<script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
<script type="text/javascript">
// configure for module loader
require.config({
paths: {
echarts: 'http://echarts.baidu.com/build/dist'
}
});
// use
require(
[
'echarts',
'echarts/chart/bar' // require the specific chart type
],
function (ec) {
// Initialize after dom ready
var myChart = ec.init(document.getElementById('main'));
var option = {
tooltip: {
show: true
},
legend: {
data:['Sales']
},
xAxis : [
{
type : 'category',
data : ["Shirts", "Sweaters", "Chiffon Shirts", "Pants", "High Heels", "Socks"]
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
"name":"Sales",
"type":"bar",
"data":[5, 20, 40, 10, 10, 20]
}
]
};
// Load data into the ECharts instance
myChart.setOption(option);
}
);
</script>
</body></xmp></pre>
<b>5, Open echarts.html in the browser to see the following results.</b>
</div>
<!------------------------------>
<div class="tab-pane" id="main1">
<b class="title">1, Creat a echarts.html file. Prepare a Dom with size (width and height) for ECharts.</b>
<pre class="prettyprint"><xmp><!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!-- Prepare a Dom with size (width and height) for ECharts -->
<div id="main" style="height:400px"></div>
</body></xmp></pre>
<b class="title">2, Create a < script > tag to import echarts-plain.js. For the imported chart file, refer to<a href="doc-en.html#Import-ECharts3" target="_blank">Import ECharts3</a></b>
<pre class="prettyprint"><xmp><!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!-- Prepare a Dom with size (width and height) for ECharts -->
<div id="main" style="height:400px"></div>
<!-- ECharts import -->
<script src="http://echarts.baidu.com/build/dist/echarts-all.js"></script>
</body></xmp></pre>
<b class="title">3, Create a <script> tag. Use global variable echarts to initialize and drive the generation of charts. For option, refer to<a href="doc-en.html#Option" target="_blank">API & Doc</a></b>
<pre class="prettyprint"><xmp><!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!-- Prepare a Dom with size (width and height) for ECharts -->
<div id="main" style="height:400px"></div>
<!-- ECharts import -->
<script src="http://echarts.baidu.com/build/dist/echarts-all.js"></script>
<script type="text/javascript">
// Initialize after dom ready
var myChart = echarts.init(document.getElementById('main'));
var option = {
tooltip: {
show: true
},
legend: {
data:['Sales']
},
xAxis : [
{
type : 'category',
data : ["Shirts", "Sweaters", "Chiffon Shirts", "Pants", "High Heels", "Socks"]
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
"name":"Sales",
"type":"bar",
"data":[5, 20, 40, 10, 10, 20]
}
]
};
// Load data into the ECharts instance
myChart.setOption(option);
</script>
</body></xmp></pre>
<b>4, Open echarts.html in the browser to see the following results.</b>
</div>
</div>
<div id="main" style="height:400px;border: 1px solid #dddddd;border-top-width:0"></div>
<div class="row" style="margin: 35px 0;">
<h2>Best Reference Resource: Instances</h2>
<p>ECharts is a data-driven chart. Since your main concern is how to achieve that option, we offer you, right here on our official website, an extensive <a href="./doc-en.html">documentation</a> for your reference and over 100 ready-made <a href="./example-en.html">demos</a> with the most core option code that is free to edit online. For ECharts, play makes perfect; hope you enjoy playing here.</p>
</div>
</div>
<script src="../build/dist/echarts.js"></script>
<script type="text/javascript">
require.config({
paths: {
echarts: '../build/dist'
}
});
require(
[
'echarts',
'echarts/chart/bar'
],
function (ec) {
var myChart = ec.init(document.getElementById('main'));
myChart.setOption(option);
}
);
var option = {
tooltip: {
show: true
},
legend: {
data:['Sales']
},
xAxis : [
{
type : 'category',
data : ["Shirts", "Sweaters", "Chiffon Shirts", "Pants", "High Heels", "Socks"]
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
"name":"Sales",
"type":"bar",
"data":[5,20,40,10,10,20]
}
]
};
</script>
<footer id="footer"></footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="./asset/js/jquery.min.js"></script>
<script type="text/javascript" src="./asset/js/echartsHome.js"></script>
<script src="./asset/js/bootstrap.min.js"></script>
</body>
</html>