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
|
<!DOCTYPE html>
< html >
< head >
< meta charset = "UTF-8" >
< title >ECharts3 學習</ title >
< script src = "../../public/js/echarts3/echarts.js" ></ script >
</ head >
< body >
< div id = "main" style = "width: 600px;height:400px;" ></ div >
< script type = "text/javascript" >
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption({
tooltip: {
trigger: 'item',
formatter: "{a} < br />{b}: {c} ({d}%)"
},
legend: {
orient: 'vertical',
x: 'left',
data:['直接訪問','郵件營銷','聯盟廣告','視頻廣告','搜索引擎']
},
series: [
{
name:'訪問來源',
type:'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
normal: {
show: false,
position: 'center'
},
emphasis: {
show: true,
textStyle: {
fontSize: '30',
fontWeight: 'bold'
}
}
},
labelLine: {
normal: {
show: true
}
},
data:[
{value:335, name:'直接訪問'},
{value:310, name:'郵件營銷'},
{value:234, name:'聯盟廣告'},
{value:135, name:'視頻廣告'},
{value:1548, name:'搜索引擎'}
]
}
]
});
</ script >
</ body >
</ html >
|