ok-admin/pages/map/map4.html

95 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>
2019-05-13 07:35:15 +00:00
<script src="../../lib/echarts/echarts.common.min.js"></script>
2018-07-25 15:47:48 +00:00
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
2019-04-14 07:09:15 +00:00
var myChart = echarts.init(document.getElementById("main"));
2018-07-25 15:47:48 +00:00
// 指定图表的配置项和数据
var option = {
2019-04-14 07:09:15 +00:00
backgroundColor: "#2c343c",
2018-08-03 08:09:17 +00:00
title: {
2019-04-14 07:09:15 +00:00
text: "定制饼图",
left: "center",
2018-08-03 08:09:17 +00:00
top: 20,
textStyle: {
2019-04-14 07:09:15 +00:00
color: "#ccc"
2018-08-03 08:09:17 +00:00
}
},
2018-07-25 15:47:48 +00:00
tooltip: {
2019-04-14 07:09:15 +00:00
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: [
{
2019-04-14 07:09:15 +00:00
name: "访问来源",
type: "pie",
radius: "55%",
center: ["50%", "50%"],
2018-08-03 08:09:17 +00:00
data: [
2019-04-14 07:09:15 +00:00
{value: 335, name: "直接访问"},
{value: 310, name: "邮件营销"},
{value: 274, name: "联盟广告"},
{value: 235, name: "视频广告"},
{value: 400, name: "搜索引擎"}
2018-08-03 08:09:17 +00:00
].sort(function (a, b) {
return a.value - b.value;
}),
2019-04-14 07:09:15 +00:00
roseType: "radius",
2018-07-25 15:47:48 +00:00
label: {
normal: {
textStyle: {
2019-04-14 07:09:15 +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: {
2019-04-14 07:09:15 +00:00
color: "rgba(255, 255, 255, 0.3)"
2018-08-03 08:09:17 +00:00
},
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: {
2019-04-14 07:09:15 +00:00
color: "#c23531",
2018-08-03 08:09:17 +00:00
shadowBlur: 200,
2019-04-14 07:09:15 +00:00
shadowColor: "rgba(0, 0, 0, 0.5)"
2018-08-03 08:09:17 +00:00
}
},
2019-04-14 07:09:15 +00:00
animationType: "scale",
animationEasing: "elasticOut",
2018-08-03 08:09:17 +00:00
animationDelay: function (idx) {
return Math.random() * 200;
}
2018-07-25 15:47:48 +00:00
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
</body>
2019-04-14 07:09:15 +00:00
</html>