前言

🚀 基于 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 数据可视化大屏展示数据概览演示案例_htmlhtml


四、代码实现

1.HTML

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>新能源车联网综合大数据平台</title>
<script src="js/jquery-2.1.1.min.js"></script>
<script>$(window).load(function() {
$(".loading").fadeOut()
})</script>
<link rel="stylesheet" href="css/common.css">
<link rel="stylesheet" href="css/map.css">
</head>

<body>
<div class="loading">
<div class="loadbox"><img src="images/loading.gif">页面加载中...</div>
</div>
<div class="data">
<div class="data-title">
<div class="title-center ">数据概览演示案例</div>
</div>
<div class="data-content">
<div class="con-left fl">
<div class="left-top">
<div class="info boxstyle">
<div class="title">实时统计</div>
<div class="info-main">
<ul>
<li><img src="images/info-img-1.png" alt=""><span>车辆总数(辆)</span>
<p>12,457</p>
</li>
<li><img src="images/info-img-2.png" alt=""><span>当前在线数(辆)</span>
<p>12,457</p>
</li>
<li><img src="images/info-img-3.png" alt=""><span>今日活跃数(辆)</span>
<p>12,457</p>
</li>
<li><img src="images/info-img-4.png" alt=""><span>今日活跃率(%)</span>
<p>74%</p>
</li>
</ul>
</div>
</div>
<div class="top-bottom boxstyle">
<div class="title">行业分类</div>
<div id="echarts_1" class="charts"></div>
</div>
</div>
<div class="left-bottom boxstyle">
<div class="title">车型分类</div>
<div id="echarts_2" class="charts"></div>
</div>
</div>
<div class="con-center fl">
<div class="map-num">
<p>实时行驶车辆(辆)</p>
<div class="num"><span>1</span><span>5</span><span>4</span><span>9</span><span>2</span><span>6</span><span>8</span></div>
</div>
<div class="cen-top map" id="map"></div>
<div class="cen-bottom boxstyle">
<div class="title">车辆充电高峰时间</div>
<div id="echarts_3" class="charts"></div>
</div>
</div>
<div class="con-right fr">
<div class="right-top boxstyle">
<div class="title">本月行驶里程TOP5</div>
<div id="echarts_4" class="charts"></div>
</div>
<div class="right-center boxstyle">
<div class="title">报警车辆TOP5</div>
<div id="echarts_5" class="charts"></div>
</div>
<div class="right-bottom boxstyle">
<div class="title">电池报警车辆TOP10</div>
<div id="echarts_6" class="charts"></div>
</div>
</div>
</div>
</div>
</body>
<script src="js/echarts.min.js"></script>
<script src="js/china.js"></script>
<script src="js/echarts.js"></script>

</html>

2.CSS

/*:非源码,演示用的代码。源代码唯一下载地址: http://www.bootstrapmb.com/item/4161。(此备注只出现在演示站,下载的源码不包含。)*/

body,
html {
height: 100%;
width: 100%
}

* {
font-family: "微软雅黑"
}

body {
background: #010e50 url(../images/map_bg.jpg) center top no-repeat;
background-size: 100% auto
}

.map {
margin-top: 15px;
position: relative;
top: 40px
}

.boxstyle {
border: 1px solid rgba(100, 162, 255, .2);
box-sizing: border-box;
position: relative;
margin-top: 15px;
background: rgba(0, 35, 120, .36)
}

.boxstyle:after,
.boxstyle:before {
position: absolute;
content: "";
width: 20px;
height: 30px
}

.boxstyle:before {
border-left: 1px solid #0258f0;
border-top: 1px solid #0258f0;
left: -1px;
top: -1px
}

.boxstyle:after {
border-right: 1px solid #0258f0;
border-bottom: 1px solid #0258f0;
right: -1px;
bottom: -1px
}

.title {
height: 35px;
font-size: 18px;
line-height: 35px;
width: 100%;
color: #fff;
font-weight: 600;
padding-left: 15px;
position: relative;
box-sizing: border-box;
}

.title:after {
position: absolute;
content: "";
width: 20%;
height: 1px;
background: #0258f0;
left: 5%;
opacity: .4;
bottom: 0;
}

.data {
width: 100%;
height: 100%
}

.data>.data-title {
width: 100%;
height: 90px;
box-sizing: border-box
}

.data>.data-title>.title-center {
text-shadow: 3px 3px 3px rgba(0, 0, 0, .3);
text-align: center;
line-height: 80px;
letter-spacing: 4px;
color: #fff;
font-size: 40px;
font-weight: bolder;
box-sizing: border-box
}

.data>.data-content {
width: 100%;
height: calc(100% - 105px);
padding: 0 20px 20px 20px;
box-sizing: border-box
}

.data>.data-content>.con-left {
width: 23.4375%;
height: 100%
}

.data>.data-content>.con-left>.left-top {
width: 100%;
height: calc(75% - 15px);
position: relative
}

.data>.data-content>.con-left>.left-top>.info {
height: 62%;
width: 100%
}

.info-main li {
float: left;
width: 50%;
padding-bottom: 10px;
text-align: center;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}

.info-main li:nth-child(1) {
border-right: 1px solid rgba(255, 255, 255, .1);
border-bottom: 1px solid rgba(255, 255, 255, .1)
}

.info-main li:nth-child(2) {
border-bottom: 1px solid rgba(255, 255, 255, .1)
}

.info-main li:nth-child(3) {
border-right: 1px solid rgba(255, 255, 255, .1)
}

.info-main li img {
display: block;
margin: 20px auto 5px auto;
}

.info-main li span {
font-size: 12px;
color: #fff;
opacity: .6;
}

.info-main li p {
font-size: 24px;
color: #fff;
font-weight: bold;
}

.info-main ul {
overflow: hidden;
}

.con-left>.left-top>.top-bottom {
height: calc(38% - 20px);
width: 100%
}

.con-left>.left-bottom {
width: 100%;
height: 25%
}

.con-center {
width: 53.125%;
height: 100%;
padding: 0 20px;
box-sizing: border-box;
position: relative
}

.map-num {
width: 500px;
height: 120px;
position: absolute;
top: 15px;
left: 50px;
z-index: 1000
}

.map-num>p {
font-size: 18px;
font-weight: 600;
color: #fff
}

.map-num span {
display: inline-block;
width: 50px;
height: 65px;
text-align: center;
line-height: 65px;
background: rgba(0, 35, 120, .56);
border: 1px solid rgba(255, 255, 255, .2);
border-radius: 5px;
color: #fff;
font-size: 68px;
font-weight: 600;
font-family: LcdD;
margin-top: 15px
}

.data>.data-content>.con-center>.cen-top {
width: 100%;
height: calc(75% - 20px);
margin-bottom: 20px
}

.data>.data-content>.con-center>.cen-bottom {
width: 100%;
height: 25%
}

.data>.data-content>.con-right {
width: 23.4375%;
height: 100%
}

.data>.data-content>.con-right>.right-top {
width: 100%;
height: 33%
}

.data>.data-content>.con-right>.right-center {
width: 100%;
height: calc(36% - 36px)
}

.data>.data-content>.con-right>.right-bottom {
width: 100%;
height: 32%
}

.data>.data-content .charts {
width: 100%;
height: calc(100% - 35px)
}

.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: #324e93;
left: 50%;
top: 50%;
margin-top: -100px;
margin-left: -75px;
}

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