ok-admin/map4.html

94 lines
2.7 KiB
HTML
Raw Normal View History

2018-07-25 15:47:48 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
2018-08-03 08:09:17 +00:00
<title>饼图</title>
2018-07-25 15:47:48 +00:00
</head>
<body>
<div id="main" style="width: 100%;height:400px;margin-top: 50px;"></div>
<script src="lib/echarts/echarts.common.min.js"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
2018-08-03 08:09:17 +00:00
backgroundColor: '#2c343c',
title: {
text: 'Customized Pie',
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
2018-07-25 15:47:48 +00:00
tooltip: {
trigger: 'item',
2018-08-03 08:09:17 +00:00
formatter: "{a} <br/>{b} : {c} ({d}%)"
2018-07-25 15:47:48 +00:00
},
2018-08-03 08:09:17 +00:00
visualMap: {
show: false,
min: 80,
max: 600,
inRange: {
colorLightness: [0, 1]
}
2018-07-25 15:47:48 +00:00
},
series: [
{
name: '访问来源',
type: 'pie',
2018-08-03 08:09:17 +00:00
radius: '55%',
center: ['50%', '50%'],
data: [
{value: 335, name: '直接访问'},
{value: 310, name: '邮件营销'},
{value: 274, name: '联盟广告'},
{value: 235, name: '视频广告'},
{value: 400, name: '搜索引擎'}
].sort(function (a, b) {
return a.value - b.value;
}),
roseType: 'radius',
2018-07-25 15:47:48 +00:00
label: {
normal: {
textStyle: {
2018-08-03 08:09:17 +00:00
color: 'rgba(255, 255, 255, 0.3)'
2018-07-25 15:47:48 +00:00
}
}
},
labelLine: {
normal: {
2018-08-03 08:09:17 +00:00
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
},
smooth: 0.2,
length: 10,
length2: 20
2018-07-25 15:47:48 +00:00
}
},
2018-08-03 08:09:17 +00:00
itemStyle: {
normal: {
color: '#c23531',
shadowBlur: 200,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
animationType: 'scale',
animationEasing: 'elasticOut',
animationDelay: function (idx) {
return Math.random() * 200;
}
2018-07-25 15:47:48 +00:00
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
</body>
</html>