前言

🚀 基于 Echarts 实现可视化数据大屏响应式展示效果的源码,,基于html+css+javascript+echarts制作, 可以在此基础上重新开发。

本项目中使用的是echarts图表库,ECharts 提供了常规的折线图、柱状图、散点图、饼图、K线图,用于统计的盒形图,用于地理数据可视化的地图、热力图、线图,用于关系数据可视化的关系图、treemap、旭日图,多维数据可视化的平行坐标,还有用于 BI 的漏斗图,仪表盘,并且支持图与图之间的混搭。

文章目录

一、Echart是什么

ECharts是一个使用 JavaScript 实现的开源可视化库,可以流畅的运行在 PC 和移动设备上,兼容当前绝大部分浏览器(IE8/9/10/11,Chrome,Firefox,Safari等),底层依赖矢量图形库 ZRender,提供直观,交互丰富,可高度个性化定制的数据可视化图表。

二、ECharts入门教程

​5 分钟上手ECharts​


三、作品演示

基于Echarts实现可视化数据大屏企业营收大数据统计_数据可视化


四、代码实现

1.HTML

<!doctype html>
<html>

<head>
<meta charset="utf-8">
<title>企业营收大数据统计html页面图表</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/echarts.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/jquery.liMarquee.js"></script>
<script type="text/javascript" src="js/jquery.cxselect.min.js"></script>
<link rel="stylesheet" href="css/comon0.css">
</head>

<body>
<div style="background:#000d4a url(images/bg.jpg) center top;">
<div class="loading">
<div class="loadbox"><img src="images/loading.gif">页面加载中...</div>
</div>
<div class="back"></div>
<div class="head">
<div class="weather"><span id="showTime"></span></div>
<h1>企业营收大数据统计</h1>
</div>
<script>var t = null;
t = setTimeout(time, 1000); /*開始运行*/
function time() {
clearTimeout(t); /*清除定时器*/
dt = new Date();
var y = dt.getFullYear();
var mt = dt.getMonth() + 1;
var day = dt.getDate();
var h = dt.getHours();
var m = dt.getMinutes();
var s = dt.getSeconds();
document.getElementById("showTime").innerHTML = y + "年" + mt + "月" + day + "日" + h + "时" + m + "分" + s + "秒";
t = setTimeout(time, 1000);
}</script>
<div class="mainbox">
<ul class="clearfix">
<li>
<div class="boxall" style="height:400px;">
<div class="alltitle">标题样式</div>
<div class="navboxall" id="echart5"></div>
</div>
<div class="boxall" style="height:260px;">
<div class="alltitle">标题样式</div>
<div class="navboxall">
<div class="wraptit"><span>单号</span><span>金额</span><span>品名</span><span>时间</span></div>
<div class="wrap">
<ul>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
<li>
<p><span>100021415</span><span>199</span><span>手机</span><span>18小时</span></p>
</li>
</ul>
</div>
</div>
</div>
<div class="boxall" style="height:260px;">
<div class="alltitle">标题样式</div>
<div class="navboxall" id="echart1"></div>
</div>
</li>
<li>
<div class="boxall" style="height:230px">
<div class="clearfix navboxall" style="height:">
<div class="pulll_left num">
<div class="numbt">总体情况<span>(单位:元)</span></div>
<div class="numtxt">19382721</div>
</div>
<div class="pulll_right zhibiao">
<div class="zb1"><span>标题样式</span>
<div id="zb1"></div>
</div>
<div class="zb2"><span>标题样式</span>
<div id="zb2"></div>
</div>
<div class="zb3"><span>标题样式</span>
<div id="zb3"></div>
</div>
</div>
</div>
</div>
<div class="boxall" style="height:350px">
<div class="alltitle">标题样式</div>
<div class="navboxall" id="echart4"></div>
</div>
<div class="boxall" style="height:340px">
<div class="alltitle">标题样式</div>
<div class="navboxall" id="echart3"></div>
</div>
</li>
<li>
<div class="boxall" style="height:300px">
<div class="alltitle">标题样式</div>
<div class="navboxall">
<table class="table1" width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th scope="col">排名</th>
<th scope="col">公司</th>
<th scope="col">数量</th>
<th scope="col">增长率</th>
</tr>
<tr>
<td><span>1</span></td>
<td>腾讯科技</td>
<td>114万<br></td>
<td>100%<br></td>
</tr>
<tr>
<td><span>2</span></td>
<td>百度公司</td>
<td>923823万</td>
<td>21%</td>
</tr>
<tr>
<td><span>3</span></td>
<td>新浪</td>
<td>1240253万</td>
<td>12%</td>
</tr>
<tr>
<td><span>4</span></td>
<td>网易</td>
<td>1.2亿</td>
<td>39%</td>
</tr>
<tr>
<td><span>5</span></td>
<td>雅虎</td>
<td>13423万</td>
<td>9%</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="boxall" style="height:">
<div class="alltitle">标题样式</div>
<div class="navboxall">
<table class="table1" width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th scope="col">排名</th>
<th scope="col">公司</th>
<th scope="col">数量</th>
<th scope="col">增长率</th>
</tr>
<tr>
<td><span>1</span></td>
<td>腾讯科技</td>
<td>114万<br></td>
<td>100%<br></td>
</tr>
<tr>
<td><span>2</span></td>
<td>百度公司</td>
<td>923823万</td>
<td>21%</td>
</tr>
<tr>
<td><span>3</span></td>
<td>新浪</td>
<td>1240253万</td>
<td>12%</td>
</tr>
<tr>
<td><span>4</span></td>
<td>网易</td>
<td>1.2亿</td>
<td>39%</td>
</tr>
<tr>
<td><span>5</span></td>
<td>雅虎</td>
<td>13423万</td>
<td>9%</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="boxall" style="height:320px">
<div class="alltitle">标题样式</div>
<div class="navboxall" id="echart2"></div>
</div>
</li>
</ul>
</div>
</div>
<script>$(function() {
$('.wrap,.adduser').liMarquee({
direction: 'up',
/*身上滚动*/ runshort: false,
/*内容不足时不滚动*/ scrollamount: 20 /*速度*/
});
});</script>
</body>

</html>

2.CSS

@charset "utf-8";
/* CSS Document 更多精品模板请访问:*/

* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}

*,
body {
padding: 0px;
margin: 0px;
color: #222;
font-family: "微软雅黑";
}

body {
color: #666;
font-size: 16px;
}

li {
list-style-type: none;
}

table {}

i {
margin: 0px;
padding: 0px;
text-indent: 0px;
}

img {
border: none;
max-width: 100%;
}

a {
text-decoration: none;
color: #399bff;
}

a.active,
a:focus {
outline: none !important;
text-decoration: none;
}

ol,
ul,
p,
h1,
h2,
h3,
h4,
h5,
h6 {
padding: 0;
margin: 0
}

a:hover {
color: #06c;
text-decoration: none !important
}

.clearfix:after,
.clearfix:before {
display: table;
content: " "
}

.clearfix:after {
clear: both
}

.pulll_left {
float: left;
}

.pulll_right {
float: right;
}

.loading {
position: fixed;
left: 0;
top: 0;
font-size: 16px;
z-index: 100000000;
width: 100%;
height: 100%;
background: #1a1a1c;
text-align: center;
}

.loadbox {
position: absolute;
width: 160px;
height: 150px;
color: rgba(255, 255, 255, .6);
left: 50%;
top: 50%;
margin-top: -100px;
margin-left: -75px;
}

.loadbox img {
margin: 10px auto;
display: block;
width: 40px;
}

.head {
height: 105px;
background: url(../images/head_bg.png) no-repeat center center;
position: relative
}

.head h1 {
color: #fff;
text-align: center;
font-size: 42px;
line-height: 90px;
;
}

.head h1 img {
width: 1.5rem;
display: inline-block;
vertical-align: middle;
margin-right: .2rem
}

.weather {
position: absolute;
right: 30px;
top: 0;
line-height: 70px;
}

.weather span {
color: rgba(255, 255, 255, .9) !important;
font-size: 24px;
}

.mainbox {
padding: 10px 20px 0 20px;
}

.mainbox>ul {
margin-left: -.4rem;
margin-right: -.4rem;
}

.mainbox>ul>li {
float: left;
padding: 0 .4rem
}

.mainbox>ul>li {
width: 24%
}

.mainbox>ul>li:nth-child(2) {
width: 52%
}

.boxall {
padding: 15px;
background: rgba(0, 0, 0, .2);
position: relative;
margin-bottom: 15px;
;
z-index: 10;
}

.alltitle {
font-size: 18px;
color: #fff;
position: relative;
padding-left: 12px;
margin-bottom: 10px;
}

.alltitle:before {
width: 5px;
height: 20px;
top: 2px;
position: absolute;
content: "";
background: #49bcf7;
border-radius: 20px;
left: 0;
}

.navboxall {
height: calc(100% - 30px);
}

.num,
.zhibiao {
height: 100%;
width: 50%;
}

.zb1,
.zb2,
.zb3 {
float: left;
width: 33.3333%;
height: 100%;
}

#zb1,
#zb2,
#zb3 {
height: calc(100% - 30px);
}

.zhibiao span {
padding-top: 20px;
display: block;
text-align: center;
color: #fff;
font-size: 16px;
}

.num {
padding-right: 20px;
}

.numbt {
font-size: 24px;
color: #fff;
padding-top: 14px;
}

.numbt span {
font-size: 18px;
padding-left: 10px;
color: #fff;
}

.numtxt {
color: #fef000;
font-size: 80px;
font-family: arial;
border-top: 1px solid rgba(255, 255, 255, .1);
border-bottom: 1px solid rgba(255, 255, 255, .1);
padding: 10px 0;
margin: 18px 0;
font-weight: bold;
letter-spacing: 2px;
}

.table1 th {
border-bottom: 1px solid rgba(255, 255, 255, .2);
font-size: 16px;
color: rgba(255, 255, 255, .6);
font-weight: normal;
padding: 0 0 10px 0;
}

.table1 td {
font-size: 16px;
color: rgba(255, 255, 255, .4);
padding: 15px 0 0 0;
}

.table1 span {
width: 24px;
height: 24px;
border-radius: 3px;
display: block;
background: #878787;
color: #fff;
line-height: 24px;
text-align: center;
}

.table1 tr:nth-child(2) span {
background: #ed405d
}

.table1 tr:nth-child(3) span {
background: #f78c44
}

.table1 tr:nth-child(4) span {
background: #49bcf7
}

.iconchart li {
height: 30px;
}

.iconchart label {
color: #fff;
line-height: 30px;
height: 30px;
display: inline-block;
opacity: .8;
}

.iconchart label img {
display: inline-block;
vertical-align: middle;
opacity: .4;
}

.iconchart .bar {
display: inline-block;
background: rgba(255, 255, 255, .1);
border: 1px solid rgba(255, 255, 255, .2);
width: 78%;
height: 20px;
padding: 2px;
position: relative;
top: 5px;
}

.iconchart .bar span {
background: linear-gradient(to right, #588fab, #5ea99c);
display: block;
width: 60%;
height: 100%;
animation: myfirst2 1s ease;
}

.iconchart .bar i {
position: absolute;
opacity: .5;
right: -36px;
color: #fff;
line-height: 20px;
top: 0;
}

/*Plugin CSS*/

.wrap {
height: 82%;
overflow: hidden;
}

.wrap li {
line-height: 40px;
height: 40px;
}

.wrap li p,
.wraptit {
font-size: 0;
}

.wrap li span,
.wraptit span {
display: inline-block;
font-size: 18px;
color: rgba(255, 255, 255, .6);
}

.wraptit {
border-bottom: 1px solid rgba(255, 255, 255, .2);
padding: 0 0 10px 0;
margin-bottom: 10px;
}

.wrap li span:nth-child(1),
.wraptit span:nth-child(1) {
width: 30%
}

.wrap li span:nth-child(2),
.wraptit span:nth-child(2) {
width: 20%
}

.wrap li span:nth-child(3),
.wraptit span:nth-child(3) {
width: 20%
}

.wrap li span:nth-child(4),
.wraptit span:nth-child(4) {
width: 30%
}

.str_wrap {
overflow: hidden;
width: 100%;
position: relative;
-moz-user-select: none;
-khtml-user-select: none;
user-select: none;
white-space: nowrap;
}

.str_move {
white-space: nowrap;
position: absolute;
top: 0;
left: 0;
cursor: move;
}

.str_move_clone {
display: inline-block;
vertical-align: top;
position: absolute;
left: 100%;
top: 0;
}

.str_vertical .str_move_clone {
left: 0;
top: 100%;
}

.str_down .str_move_clone {
left: 0;
bottom: 100%;
}

.str_vertical .str_move,
.str_down .str_move {
white-space: normal;
width: 100%;
}

.str_static .str_move,
.no_drag .str_move,
.noStop .str_move {
cursor: inherit;
}

.str_wrap img {
max-width: none !important;
}

@keyframes {
from {
width: 0
}
to {}
}

3.JavaScript

$(window).load(function() {
$(".loading").fadeOut()
});
$(function() {
i();
j();
k();
l();
m();
n();
o();
p();

function i() {
var a = echarts.init(document.getElementById("echart1"));
option = {
tooltip: {
trigger: "item",
formatter: "{b} : {c} ({d}%)"
},
legend: {
right: 0,
top: 30,
height: 160,
itemWidth: 10,
itemHeight: 10,
itemGap: 10,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: 12
},
orient: "vertical",
data: ["图例1", "图例2", "图例3", "图例4", "图例5"]
},
calculable: true,
series: [{
name: " ",
color: ["#62c98d", "#2f89cf", "#4cb9cf", "#53b666", "#62c98d", "#205acf", "#c9c862", "#c98b62", "#c962b9", "#7562c9", "#c96262", "#c25775", "#00b7be"],
type: "pie",
radius: [30, 70],
center: ["35%", "50%"],
roseType: "radius",
label: {
normal: {
show: true
},
emphasis: {
show: true
}
},
lableLine: {
normal: {
show: true
},
emphasis: {
show: true
}
},
data: [{
value: 10,
name: "图例1"
}, {
value: 5,
name: "图例2"
}, {
value: 15,
name: "图例3"
}, {
value: 25,
name: "图例4"
}, {
value: 20,
name: "图例5"
}, ]
}, ]
};
a.setOption(option);
window.addEventListener("resize", function() {
a.resize()
})
}

function j() {
var a = echarts.init(document.getElementById("echart2"));
option = {
tooltip: {
trigger: "item",
formatter: "{b} : {c} ({d}%)"
},
legend: {
top: "15%",
data: ["图例1", "图例2", "图例3", "图例4", "图例5"],
icon: "circle",
textStyle: {
color: "rgba(255,255,255,.6)",
}
},
calculable: true,
series: [{
name: "",
color: ["#62c98d", "#2f89cf", "#4cb9cf", "#53b666", "#62c98d", "#205acf", "#c9c862", "#c98b62", "#c962b9", "#c96262"],
type: "pie",
startAngle: 0,
radius: [51, 100],
center: ["50%", "45%"],
roseType: "area",
avoidLabelOverlap: false,
label: {
normal: {
show: true,
},
emphasis: {
show: true
}
},
labelLine: {
normal: {
show: true,
length2: 1,
},
emphasis: {
show: true
}
},
data: [{
value: 1,
name: "图例1",
}, {
value: 4,
name: "图例2",
}, {
value: 5,
name: "图例3",
}, {
value: 6,
name: "图例4",
}, {
value: 9,
name: "图例5",
}, {
value: 0,
name: "",
label: {
show: false
},
labelLine: {
show: false
}
}, {
value: 0,
name: "",
label: {
show: false
},
labelLine: {
show: false
}
}, {
value: 0,
name: "",
label: {
show: false
},
labelLine: {
show: false
}
}, {
value: 0,
name: "",
label: {
show: false
},
labelLine: {
show: false
}
}, {
value: 0,
name: "",
label: {
show: false
},
labelLine: {
show: false
}
}, ]
}]
};
a.setOption(option);
window.addEventListener("resize", function() {
a.resize()
})
}

function k() {
var a = echarts.init(document.getElementById("echart3"));
option = {
tooltip: {
trigger: "axis",
axisPointer: {
lineStyle: {
color: "#57617B"
}
}
},
legend: {
data: ["销售额", "利润"],
top: "0",
textStyle: {
color: "#fff"
},
itemGap: 20,
},
grid: {
left: "0",
right: "20",
top: "10",
bottom: "20",
containLabel: true
},
xAxis: [{
type: "category",
boundaryGap: false,
axisLabel: {
show: true,
textStyle: {
color: "rgba(255,255,255,.6)"
}
},
axisLine: {
lineStyle: {
color: "rgba(255,255,255,.1)"
}
},
data: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
}, {}],
yAxis: [{
axisLabel: {
show: true,
textStyle: {
color: "rgba(255,255,255,.6)"
}
},
axisLine: {
lineStyle: {
color: "rgba(255,255,255,.1)"
}
},
splitLine: {
lineStyle: {
color: "rgba(255,255,255,.1)"
}
}
}],
series: [{
name: "销售额",
type: "line",
smooth: true,
symbol: "circle",
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 2
}
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: "rgba(24, 163, 64, 0.3)"
}, {
offset: 0.8,
color: "rgba(24, 163, 64, 0)"
}], false),
shadowColor: "rgba(0, 0, 0, 0.1)",
shadowBlur: 10
}
},
itemStyle: {
normal: {
color: "#cdba00",
borderColor: "rgba(137,189,2,0.27)",
borderWidth: 12
}
},
data: [220, 182, 191, 134, 150, 120, 110, 125, 145, 122, 165, 122]
}, {
name: "利润",
type: "line",
smooth: true,
symbol: "circle",
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 2
}
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: "rgba(39, 122,206, 0.3)"
}, {
offset: 0.8,
color: "rgba(39, 122,206, 0)"
}], false),
shadowColor: "rgba(0, 0, 0, 0.1)",
shadowBlur: 10
}
},
itemStyle: {
normal: {
color: "#277ace",
borderColor: "rgba(0,136,212,0.2)",
borderWidth: 12
}
},
data: [120, 110, 125, 145, 122, 165, 122, 220, 182, 191, 134, 150]
}]
};
a.setOption(option);
window.addEventListener("resize", function() {
a.resize()
})
}

function l() {
var a = echarts.init(document.getElementById("echart4"));
option = {
tooltip: {
trigger: "axis",
axisPointer: {
lineStyle: {
color: "#57617B"
}
}
},
legend: {
data: [{
name: "图例1"
}, {
name: "图例2"
}, {
name: "完成率"
}],
top: "0%",
textStyle: {
color: "rgba(255,255,255,0.9)"
}
},
xAxis: [{
type: "category",
data: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
axisLine: {
lineStyle: {
color: "rgba(255,255,255,.1)"
}
},
axisLabel: {
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: "14",
},
},
}, ],
yAxis: [{
type: "value",
name: "金额",
min: 0,
max: 50,
interval: 10,
axisLabel: {
show: true,
},
axisLine: {
lineStyle: {
color: "rgba(255,255,255,.4)"
}
},
}, {
type: "value",
name: "完成率",
show: true,
axisLabel: {
show: true,
},
axisLine: {
lineStyle: {
color: "rgba(255,255,255,.4)"
}
},
splitLine: {
show: true,
lineStyle: {
color: "#001e94"
}
},
}, ],
grid: {
top: "10%",
right: "30",
bottom: "30",
left: "30",
},
series: [{
name: "图例1",
type: "bar",
data: [4, 6, 36, 6, 8, 6, 4, 6, 30, 6, 8, 12],
barWidth: "auto",
itemStyle: {
normal: {
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0,
color: "#609db8"
}, {
offset: 1,
color: "#609db8"
}],
globalCoord: false
}
}
}
}, {
name: "图例2",
type: "bar",
data: [4, 2, 34, 6, 8, 6, 4, 2, 32, 6, 8, 18],
barWidth: "auto",
itemStyle: {
normal: {
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0,
color: "#66b8a7"
}, {
offset: 1,
color: "#66b8a7"
}],
globalCoord: false
}
}
},
barGap: "0"
}, {
name: "完成率",
type: "line",
yAxisIndex: 1,
data: [100, 50, 80, 30, 90, 40, 70, 33, 100, 40, 80, 20],
lineStyle: {
normal: {
width: 2
},
},
itemStyle: {
normal: {
color: "#cdba00",
}
},
smooth: true
}]
};
a.setOption(option);
window.addEventListener("resize", function() {
a.resize()
})
}

function m() {
var b = echarts.init(document.getElementById("echart5"));
var a = {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0,
color: "rgba(41, 121, 255, 1)"
}, {
offset: 1,
color: "rgba(0, 192, 255, 1)"
}],
globalCoord: false
};
var c = {
tooltip: {
show: false
},
grid: {
top: "0%",
left: "65",
right: "14%",
bottom: "0%",
},
xAxis: {
min: 0,
max: 100,
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
},
axisLabel: {
show: false
}
},
yAxis: {
data: ["字段名称", "字段名称", "字段名称", "字段名称", "字段名称", "字段名称", "字段名称", "字段名称", "字段名称", "字段名称", "字段名称"],
axisTick: {
show: false
},
axisLine: {
show: false
},
axisLabel: {
color: "rgba(255,255,255,.6)",
fontSize: 14
}
},
series: [{
type: "bar",
label: {
show: true,
zlevel: 10000,
position: "right",
padding: 10,
color: "#49bcf7",
fontSize: 14,
formatter: "{c}%"
},
itemStyle: {
color: "#49bcf7"
},
barWidth: "15",
data: [49, 80, 67, 99, 12, 19, 39, 84, 28, 47, 57, 100],
z: 10
}, {
type: "bar",
barGap: "-100%",
itemStyle: {
color: "#fff",
opacity: 0.1
},
barWidth: "15",
data: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
z: 5
}],
};
b.setOption(c);
window.addEventListener("resize", function() {
b.resize()
})
}

function n() {
var a = echarts.init(document.getElementById("zb1"));
var b = 298;
var c = 523;
var d = b + c;
option = {
series: [{
type: "pie",
radius: ["60%", "70%"],
color: "#49bcf7",
label: {
normal: {
position: "center"
}
},
data: [{
value: c,
name: "女消费",
label: {
normal: {
formatter: c + "",
textStyle: {
fontSize: 20,
color: "#fff",
}
}
}
}, {
value: b,
name: "男消费",
label: {
normal: {
formatter: function(e) {
return "占比" + Math.round(c / d * 100) + "%"
},
textStyle: {
color: "#aaa",
fontSize: 12
}
}
},
itemStyle: {
normal: {
color: "rgba(255,255,255,.2)"
},
emphasis: {
color: "#fff"
}
},
}]
}]
};
a.setOption(option);
window.addEventListener("resize", function() {
a.resize()
})
}

function o() {
var a = echarts.init(document.getElementById("zb2"));
var b = 298;
var c = 523;
var d = b + c;
option = {
series: [{
type: "pie",
radius: ["60%", "70%"],
color: "#cdba00",
label: {
normal: {
position: "center"
}
},
data: [{
value: b,
name: "男消费",
label: {
normal: {
formatter: b + "",
textStyle: {
fontSize: 20,
color: "#fff",
}
}
}
}, {
value: c,
name: "女消费",
label: {
normal: {
formatter: function(e) {
return "占比" + Math.round(b / d * 100) + "%"
},
textStyle: {
color: "#aaa",
fontSize: 12
}
}
},
itemStyle: {
normal: {
color: "rgba(255,255,255,.2)"
},
emphasis: {
color: "#fff"
}
},
}]
}]
};
a.setOption(option);
window.addEventListener("resize", function() {
a.resize()
})
}

function p() {
var a = echarts.init(document.getElementById("zb3"));
var b = 298;
var c = 523;
var d = b + c;
option = {
series: [{
type: "pie",
radius: ["60%", "70%"],
color: "#62c98d",
label: {
normal: {
position: "center"
}
},
data: [{
value: c,
name: "女消费",
label: {
normal: {
formatter: c + "",
textStyle: {
fontSize: 20,
color: "#fff",
}
}
}
}, {
value: b,
name: "男消费",
label: {
normal: {
formatter: function(e) {
return "占比" + Math.round(c / d * 100) + "%"
},
textStyle: {
color: "#aaa",
fontSize: 12
}
}
},
itemStyle: {
normal: {
color: "rgba(255,255,255,.2)"
},
emphasis: {
color: "#fff"
}
},
}]
}]
};
a.setOption(option);
window.addEventListener("resize", function() {
a.resize()
})
}
});