前言
🚀 基于 Echarts 实现可视化数据大屏响应式展示效果的源码,,基于html+css+javascript+echarts制作, 可以在此基础上重新开发。
本项目中使用的是echarts图表库,ECharts 提供了常规的折线图、柱状图、散点图、饼图、K线图,用于统计的盒形图,用于地理数据可视化的地图、热力图、线图,用于关系数据可视化的关系图、treemap、旭日图,多维数据可视化的平行坐标,还有用于 BI 的漏斗图,仪表盘,并且支持图与图之间的混搭。
文章目录
- 前言
- 一、Echart是什么
- 二、ECharts入门教程
- 三、作品演示
- 四、代码实现
- 1.HTML
- 2.CSS
- 3.JavaScript
- 4.Echarts
- 五、更多干货
一、Echart是什么
ECharts是一个使用 JavaScript 实现的开源可视化库,可以流畅的运行在 PC 和移动设备上,兼容当前绝大部分浏览器(IE8/9/10/11,Chrome,Firefox,Safari等),底层依赖矢量图形库 ZRender,提供直观,交互丰富,可高度个性化定制的数据可视化图表。
二、ECharts入门教程
5 分钟上手ECharts
三、作品演示
四、代码实现
1.HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>数据可视化demo</title>
<link href="../styles/common.css" rel="stylesheet">
<script src="../scripts/Plugin/jquery-3.3.1.min.js"></script>
<script src="https://www.jq22.com/jquery/echarts-4.2.1.min.js"></script>
<script src="../scripts/Plugin/bmap.min.js"></script>
<script src="../scripts/common.js"></script>
<script src="../scripts/quota.js"></script>
</head>
<body>
<header class="header left">
<div class="left nav">
<ul>
<li><i class="nav_1"></i><a href="index.html">采集概况</a> </li>
<li><i class="nav_2"></i><a href="quota.html">指标分析</a> </li>
<li><i class="nav_3"></i><a href="trend.html">趋势分析</a> </li>
<li class="nav_active"><i class="nav_4"></i><a href="chronic.html">慢病病人列表</a> </li>
</ul>
</div>
<div class="header_center left" style="position:relative">
<h2><strong>大数据展示</strong></h2>
</div>
<div class="right nav text_right">
<ul>
</ul>
</div>
</header>
<div class="con left">
<div class="con_div">
<div class="con_div_text left">
<div class="con_div_text01 left">
<img src="../images/info_7.png" class="left text01_img" />
<div class="left text01_div">
<p>全年医疗费用(万元)</p>
<p>1235</p>
</div>
</div>
<div class="con_div_text01 right">
<img src="../images/info_8.png" class="left text01_img" />
<div class="left text01_div">
<p>当月医疗费用(万元)</p>
<p>235</p>
</div>
</div>
</div>
<div class="con_div_text left">
<div class="con_div_text01 left">
<img src="../images/info_9.png" class="left text01_img" />
<div class="left text01_div">
<p>全年体检人数(人)</p>
<p class="sky">12356</p>
</div>
</div>
<div class="con_div_text01 right">
<img src="../images/info_10.png" class="left text01_img" />
<div class="left text01_div">
<p>当月体检人数(人)</p>
<p class="sky">12356</p>
</div>
</div>
</div>
<div class="con_div_text left">
<div class="con_div_text01 left">
<img src="../images/info_11.png" class="left text01_img" />
<div class="left text01_div">
<p>西药占比</p>
<p class="org">92%</p>
</div>
</div>
<div class="con_div_text01 right">
<img src="../images/info_12.png" class="left text01_img" />
<div class="left text01_div">
<p>中药占比</p>
<p class="org">8%</p>
</div>
</div>
</div>
</div>
<div class="div_any">
<div class="left div_any01">
<div class="div_any_child">
<div class="div_any_title"><img src="../images/title_5.png">各医院门诊人次(人)</div>
<p id="histogramChart1" class="p_chart"></p>
</div>
<div class="div_any_child">
<div class="div_any_title"><img src="../images/title_6.png">各医院住院人次(人)</div>
<p id="histogramChart2" class="p_chart"></p>
</div>
</div>
<div class="left div_any01">
<div class="div_any_child">
<div class="div_any_title"><img src="../images/title_7.png">各医院医疗费用(元)</div>
<p id="lineChart1" class="p_chart"></p>
</div>
<div class="div_any_child">
<div class="div_any_title"><img src="../images/title_8.png">各医院体检人次(人)</div>
<p id="lineChart2" class="p_chart"></p>
</div>
</div>
<div class="left div_any01">
<div class="div_any_child">
<div class="div_any_title"><img src="../images/title_9.png">药占比(%)</div>
<p id="histogramChart3" class="p_chart"></p>
</div>
<div class="div_any_child">
<div class="div_any_title"><img src="../images/title_10.png">平均住院天数(天)</div>
<p id="histogramChart4" class="p_chart"></p>
</div>
</div>
<div class="left div_any01">
<div class="div_any_child">
<div class="div_any_title"><img src="../images/title_11.png">手术工作量(台)</div>
<p id="pieChart1" class="p_chart"></p>
</div>
<div class="div_any_child">
<div class="div_any_title"><img src="../images/title_12.png">床位数量分布(床)</div>
<p id="pieChart2" class="p_chart"></p>
</div>
</div>
</div>
</div>
</body>
</html>
2.CSS
body{
font-size: 100%;
height: 100%;
background-color: #081832;
}
a:hover{
text-decoration: none;
}
.left{
float: left;
}
.right{
float: right;
}
.clear{
clear: both;
}
.text_right{
text-align: right;
}
.header{
width: 100%;
height: 80px;
background-color: #030829;
}
.header_center{
width: 30%;
margin: 0px auto;
color: #FFFFff;
text-align: center;
height: 80px;
background-image: url("../images/logoBg.png");
background-size: 100% 100%;
font-family: "微软雅黑"!important;
}
.header_center h2{
margin-top: 16px !important;
font-size: 22px !important;
}
.color_font{
color: #e8f7fe !important;
font-size: 12px !important;
}
.header_logo{
margin-left: 1%;
margin-top: 12px;
}
.header_logo img{
height: 56px;
}
.nav{
width: 35%;
}
.nav>ul{
}
.nav>ul>li{
display: inline-block;
width: 120px;
text-align: center;
height: 50px;
position: relative;
line-height: 50px;
margin-top: 15px;
box-sizing: border-box;
/*box-shadow: -5px 0px 5px #034c6a inset, !*左边阴影*!*/
/*0px -5px 15px #034c6a inset, !*上边阴影*!*/
/*5px 0px 15px #034c6a inset, !*å³è¾¹é˜´å½±*!*/
/*0px 5px 15px #034c6a inset;*/
border-radius: 5px;
}
.nav>ul>li:hover{
box-shadow: -10px 0px 15px #034c6a inset, /*左边阴影*/
0px -10px 15px #034c6a inset, /*上边阴影*/
10px 0px 15px #034c6a inset, /*å³è¾¹é˜´å½±*/
0px 10px 15px #034c6a inset;
box-sizing: border-box;
}
.nav>ul>li i{
width: 16px;
height: 16px;
display: inline-block;
position: relative;
top:3px;
margin-right: 5px;
}
.nav>ul>li>a{
color: #ffffff;
/*display: inline-block;*/
/*padding: 0 15px 0 5px;*/
font-size: 14px;
}
/*.nav>ul>li:hover .li_ul{*/
/*display: block;*/
/*}*/
.li_ul{
position: absolute;
background-color: #030829;
width: 100%;
/*border-top:4px solid #4b8df8;*/
display: none;
z-index: 999;
}
.li_ul li{
line-height: 40px !important;
}
.li_ul li:hover{
background-color: #4b8df8;
}
.li_ul li a{
color: #ffffff;
font-size: 13px;
}
.nav_1{
background: url("../images/nav_1.png");
}
.nav_2{
background-image: url("../images/nav_2.png");
}
.nav_3{
background-image: url("../images/nav_3.png");
}
.nav_4{
background-image: url("../img/nav_4.png");
}
.nav_5{
background-image: url("../img/nav_5.png");
}
.nav_6{
background-image: url("../img/nav_6.png");
}
.nav_7{
background-image: url("../img/nav_7.png");
}
.nav_8{
background-image: url("../img/nav_9.png");
}
.nav_active{
border-bottom: 4px solid #4b8df8;
box-shadow: -10px 0px 15px #034c6a inset, /*左边阴影*/
0px -10px 15px #034c6a inset, /*上边阴影*/
10px 0px 15px #034c6a inset, /*å³è¾¹é˜´å½±*/
0px 10px 15px #034c6a inset;
box-sizing: border-box;
}
.con{
width: 100%;
background-color: #081832;
padding-top: 20px;
padding-bottom: 20px;
}
.con1{
width: 100%;
background-color: #081832cc;
/*padding-bottom: 4px;*/
box-sizing: border-box;
overflow: auto;
;
}
.find_expend{
display: none;
}
.con1::before{
content: "";
display: block;
clear: both;
visibility: hidden;
height: 0;
}
.select_time{
width: 140px;
height: 36px;
margin-bottom: 25px;
margin-left: 1%;
padding-left: 20px;
;
}
.select_time img{
height: 18px;
margin-top: 9px;
}
.select_time input{
border: none;
background-color: transparent;
width: 80px;
height: 20px;
top:-5px;
margin-left: 10px;
position: relative;
text-indent: 1em;
outline: none;
}
.con_div{
height: 110px;
width: 98%;
margin-left: 1%;
margin-bottom: 25px;
}
.con_div_text{
height: 100%;
background-color: #034c6a;
width: 32%;
margin-right: 1.3%;
}
.con_div_text01{
width: 50%;
height: 100%;
}
.text01_img{
width: 40px;
height: 40px;
margin-left: 5%;
margin-top: 35px;
}
.text01_div{
margin-top: 15px;
margin-left: 5%;
text-align: center;
}
.text01_div p{
line-height: 35px;
}
.text01_div p:nth-child(1){
font-size: 13px;
color: #ffffff;
}
.text01_div p:nth-child(2){
font-size: 28px;
color: #ffff43;
font-weight: 600;
}
.red{
color: red !important;
}
.sky{
color: #25f3e6 !important;
}
.org{
color: #ff4e4e !important;
}
.div_any{
width: 98%;
margin-left: 1%;
margin-bottom: 25px;
height: 610px;
}
.div_any01{
width: 23%;
margin-right: 2%;
}
.div_any02{
width: 48%;
margin-right: 2%;
}
.div_any03{
width: 98%;
margin: 15px auto;
}
.div_any_child{
width: 100%;
height: 330px;
box-shadow: -10px 0px 15px #034c6a inset, /*左边阴影*/
0px -10px 15px #034c6a inset, /*上边阴影*/
10px 0px 15px #034c6a inset, /*å³è¾¹é˜´å½±*/
0px 10px 15px #034c6a inset;
border: 1px solid #034c6a;
box-sizing: border-box;
position: relative;
margin-top: 25px;
}
.div_any_child01{
width: 48%;
box-shadow: -10px 0px 15px #034c6a inset, /*左边阴影*/
0px -10px 15px #034c6a inset, /*上边阴影*/
10px 0px 15px #034c6a inset, /*å³è¾¹é˜´å½±*/
0px 10px 15px #034c6a inset;
border: 1px solid #034c6a;
box-sizing: border-box;
position: relative;
margin-right: 2%;
}
.div_any_child01_wh{
width: 98% !important;
}
.div_height01{
height: auto !important;
padding: 5px;
}
.char_table{
height: 200px;
}
.p_chart{
height: 288px;
padding: 5px 10px;
margin-top: 15px;
}
#map_div{
width: 96%;
height: 94%;
}
.div_height{
height:685px !important;
}
.div_any_title{
background-color: #034c6a;
border-radius: 18px;
position: absolute;
height: 35px;
width: 60%;
top:-15px;
color: #ffffff;
font-weight: bold;
font-size: 16px;
left: 20%;
line-height: 35px;
text-align: center;
}
.div_any_title img{
width: 18px;
height: 18px;
position: relative;
top:2px;
margin-right: 5px;
}
.any_title_width{
width: 30% !important;
left: 35% !important;
}
.div_table{
width: 98%;
margin-left: 1%;
margin-bottom: 25px;
height: 280px;
}
.div_table_box{
width: 23%;
margin-right: 2%;
}
.table_p{
height: 93%;
margin-top: 7%;
position: relative;
}.table_p01{
height:auto !important;
margin-top: 0!important;
position: relative;
}
.table_p01 table td{
padding: 6px 0;
}
.table_p table{
width: 100%;
height: 100%;
border-collapse: collapse;
position: absolute;
text-align: center;
}
.table_p table thead th{
color: #61d2f7;
font-size: 14px;
font-weight: 600;
padding-top: 5px;
padding-bottom: 5px;
}
.table_p table tbody{
color: #ffffff;
font-size: 13px;
}
.table_p table tbody tr:nth-child(2n+1){
background-color: #072951;
box-shadow: -10px 0px 15px #034c6a inset,
10px 0px 15px #034c6a inset;
}
.car_left{
width: 18%;
height: 100%;
background-color: #081832;
}
.car_center{
height: 100%;
background-color: #081832;
width: 50.5%;
margin-left: 0.5%;
}
3.JavaScript
function callResourceAdapter(type, url, requestContent, successCallback,) {
if (requestContent == null){
requestContent = {};
}
if (type == null){
type = 'POST';
}
function invocationSuccess(result) {
var resultJson = result;
if(resultJson.msgCode == '800'){
if (successCallback && typeof(successCallback) == "function") {
successCallback(resultJson.rows,resultJson.map,resultJson.vo,resultJson.msg);
}
}
if(resultJson.msgCode == '801'){
showToast(resultJson.msg);
}
if(resultJson.msgCode == '900'){
var message = '系统错误,请联系管理员';
if(resultJson.msg){
message = resultJson.msg;
}
showToast(message);
if (failCallback && typeof(failCallback) == "function") {
failCallback();
}
}
}
function invocationFailure(error) {
showToast('无法连接至服务器,请稍后再试');
if (failCallback && typeof(failCallback) == "function") {
failCallback();
}
}
$.ajax({
type: type,
url: serverUrl+url,
data: JSON.stringify(requestContent),
crossDomain:true,
contentType: "application/json; charset=utf-8",
// dataType: "json",
timeout:120000,
statusCode:{
404: function() {
showToast('服务器无响应,请稍后再试')
},
422: function() {
showToast('应用程序请求对象错误,请稍后再试')
},
403: function() {
showToast('无访问权限')
},
400: function() {
showToast('应用程序请求无效,请稍后再试')
},
},
success: function (data, textStatus,) {
switch (jqXHR.status) {
case 200:
invocationSuccess(data);
break;
default:
break;
}
},
error: function (jqXHR, textStatus,errorThrown) {
invocationFailure(jqXHR);
}
})
}
function showToast(text,timeout) {
$(".yui-toast-mask").remove();
var html = [
'<div class="yui-toast-mask">',
'<div class="yui-toast">',
'<div class="yui-toast-text">'+text+'</div>',
'</div>',
'</div>',
];
var dom = $(html.join(''));
$("body").append(dom);
if(timeout&&typeof(timeout)=='number'){
setTimeout(function () {
dom.remove();
},timeout);
}
$(".yui-toast-mask").click(function () {
dom.remove();
});
}
function hideToast() {
$(".yui-toast-mask").remove();
}
function loaderShow() {
var loadPage = $('<div class="loading" style="top:30%;left:50%;position: absolute;background: transparent;text-align: center;">' +
'<img src="../images/loading.gif" />' +
'</div>');
$("#content").append(loadPage);
}
function loaderHide() {
$(".loading").remove();
}
function getLocationDom() {
var that = this;
var html = "<div id='breadcrumb'>";
$.each(LOCATION,function(index,data){
if(index==0){
html += '<a href="javascript:void(0)" class="tip-bottom"><i class="fa fa-home"></i>'+data+'</a>';
return ;
}
if(index==LOCATION.length-1){
html += '<a class="current">'+data+'</a>';
return ;
}
html += "<a href='javascript:void(0)'>"+data+"</a>";
});
html += "</div>";
$("#content-header").html(html);
}
function getNav(successCallback) {
var postNav = [];
postNav.push('<li class="submenu" data-for= "home">','<a href="javascript:void(0)"><span>首页</span></a>');
postNav.push('<li class="submenu" data-for= "analysis">','<a href="javascript:void(0)"><span>指标统计</span></a>');
postNav.push('<li class="submenu" data-for= "trend">','<a href="javascript:void(0)"><span>趋势排名</span></a>');
$("#sidebar ul").html(postNav.join(''));
if (successCallback&&typeof(successCallback) == 'function'){
successCallback();
}
}
function bindNav(navId) {
var HEIGHT = $("body").height()-100;
$("#content").height(HEIGHT);
$(".container-fluid").slimScroll({
height: HEIGHT+'px', //容器高度,默认250px
size: '5px', //滚动条宽度,默认7px
railColor: '#000000', //滚动条背景轨迹颜色,默认#333333
railOpacity: 0.3, //滚动条背景轨迹透明度,默认0.2
wheelStep: 10, //滚动条滚动值,默认20
disableFadeOut: false //是否禁用鼠标在内容处一定时间不动隐藏滚动条,当设置alwaysVisible为true时该参数无效,默认false
});
$("#"+navId).delegate("li[data-for='home']","click",function(){
window.location.href="home.html"
}).delegate("li[data-for='analysis']","click",function(){
window.location.href="analysis.html"
}).delegate("li[data-for='trend']","click",function(){
window.location.href="trend.html"
})
}
function last_year_month() {
var list = [];
var date = getFormatDate(new Date());
var year = date.split("-")[0];
var mouth = date.split("-")[1];
for (var i=0;i<12;i++){
var objM = mouth-i;
var objY = year;
if(objM<=0){
objM = objM+12;
objY = year -1;
}
if(objM<10){
objM = "0"+objM;
}
var obj = objY +"-"+objM;
list.push(obj)
}
return list;
}
function getFormatDate(date){
var year = date.getFullYear();
var month = date.getMonth()+1;
var day = date.getDate();
if(month<10){
month = '0'+month.toString();
}
month = month.toString();
if(day<10){
day = '0'+day.toString();
}
day = day.toString();
return year+'-'+month+'-'+day;
}
function last_month_day() {
var list = [];
var date = getFormatDate(new Date());
var year = date.split("-")[0];
var mouth = date.split("-")[1];
var day = date.split("-")[2]-1;
for (var i=0;i<30;i++){
var objM = mouth;
var objD = day-i;
if(objD<=0){
objD = objD+30;
objM = mouth -1;
objM = "0"+objM
}
var obj = year+"-"+objM +"-"+objD;
list.push(obj)
}
return list;
}
function getFormatMonth(date){
var year = date.getFullYear();
var month = date.getMonth()+1;
var day = date.getDate();
if(month<10){
month = '0'+month.toString();
}
month = month.toString();
if(day<10){
day = '0'+day.toString();
}
day = day.toString();
return year+'-'+month;
}
//分页
function paging(totalPage,currentPage) {
$("#pagination").pagination({
currentPage: currentPage,
totalPage: totalPage,
isShow: true,
count: 8,
homePageText: "首页",
endPageText: "尾页",
prevPageText: "上一页",
nextPageText: "下一页",
callback: function(current) {
$("#current").text(current)
}
});
}
4.Echarts
$(function(){
init();
})
function init(){
var myColor = ['#1089E7', '#F57474', '#56D0E3', '#F8B448', '#8B78F6'];
//各医院门诊人次
var histogramChart1 = echarts.init(document.getElementById('histogramChart1'));
histogramChart1.setOption({
grid: {
top: '20%',
left: '32%'
},
xAxis: {
show: false
},
yAxis: [{
show: true,
data: ['厦门第一医院','厦门中山医院','厦门中医院','厦门第五医院',],
inverse: true,
axisLine: {
show: false
},
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
color: '#fff',
formatter: (value,) => {
return [
`{lg|${index+1}} ` + '{title|' + value + '} '
].join('\n')
},
rich: {
lg: {
backgroundColor: '#339911',
color: '#fff',
borderRadius: 15,
// padding: 5,
align: 'center',
width: 15,
height: 15
},
}
},
}, {
show: true,
inverse: true,
data: [4000, 3000, 2000, 1000],
axisLabel: {
textStyle: {
fontSize: 12,
color: '#fff',
},
},
axisLine: {
show: false
},
splitLine: {
show: false
},
axisTick: {
show: false
},
}],
series: [{
name: '条',
type: 'bar',
yAxisIndex: 0,
data: [40, 30, 20, 10],
barWidth: 10,
itemStyle: {
normal: {
barBorderRadius: 20,
color: function(params) {
var num = myColor.length;
return myColor[params.dataIndex % num]
},
}
},
label: {
normal: {
show: true,
position: 'inside',
formatter: '{c}%'
}
},
}, {
name: '框',
type: 'bar',
yAxisIndex: 1,
barGap: '-100%',
data: [100, 100, 100, 100],
barWidth: 15,
itemStyle: {
normal: {
color: 'none',
borderColor: '#00c1de',
borderWidth: 3,
barBorderRadius: 15,
}
}
}, ]
})
//各医院住院人次
var histogramChart2 = echarts.init(document.getElementById('histogramChart2'));
histogramChart2.setOption({
grid: {
top: '20%',
left: '32%'
},
xAxis: {
show: false
},
yAxis: [{
show: true,
data: ['厦门第一医院','厦门中山医院','厦门中医院','厦门第五医院',],
inverse: true,
axisLine: {
show: false
},
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
color: '#fff',
formatter: (value,) => {
return [
`{lg|${index+1}} ` + '{title|' + value + '} '
].join('\n')
},
rich: {
lg: {
backgroundColor: '#339911',
color: '#fff',
borderRadius: 15,
// padding: 5,
align: 'center',
width: 15,
height: 15
},
}
},
}, {
show: true,
inverse: true,
data: [2200, 2400, 2600, 2800],
axisLabel: {
textStyle: {
fontSize: 12,
color: '#fff',
},
},
axisLine: {
show: false
},
splitLine: {
show: false
},
axisTick: {
show: false
},
}],
series: [{
name: '条',
type: 'bar',
yAxisIndex: 0,
data: [22, 24, 26, 28],
barWidth: 10,
itemStyle: {
normal: {
barBorderRadius: 20,
color: function(params) {
var num = myColor.length;
return myColor[params.dataIndex % num]
},
}
},
label: {
normal: {
show: true,
position: 'inside',
formatter: '{c}%'
}
},
}, {
name: '框',
type: 'bar',
yAxisIndex: 1,
barGap: '-100%',
data: [100, 100, 100, 100],
barWidth: 15,
itemStyle: {
normal: {
color: 'none',
borderColor: '#00c1de',
borderWidth: 3,
barBorderRadius: 15,
}
}
}, ]
})
//手术工作量
var pieChart1 = echarts.init(document.getElementById('pieChart1'));
pieChart1.setOption({
color:["#87cefa","#ff7f50","#32cd32","#da70d6",],
tooltip : {
trigger: 'item',
formatter: "{a}<br/>{b}<br/>{c}台"
},
calculable : true,
series : [
{
name:'手术工作量',
type:'pie',
radius : [30, 110],
center : ['50%', '50%'],
roseType : 'area',
x: '50%',
max: 40,
sort : 'ascending',
data:[
{value:10, name:'厦门第一医院'},
{value:5, name:'厦门中山医院'},
{value:15, name:'厦门中医院'},
{value:25, name:'厦门第五医院'},
]
}
]
})
//医疗费用
var lineChart1 = echarts.init(document.getElementById('lineChart1'));
lineChart1.setOption( {
color:["#87cefa","#ff7f50","#32cd32","#da70d6",],
tooltip : {
trigger: 'item',
formatter: "{a}<br/>{b}<br/>{c}元"
},
legend: {
data:['厦门第一医院','厦门中山医院','厦门中医院','厦门第五医院',],
y: 'bottom',
x:'center',
textStyle:{
color:'#fff',
fontSize:12
}
},
grid:{
left: '5%',
right: '5%',
bottom: '10%',
containLabel: true
},
calculable : true,
xAxis : [
{
type : 'category',
boundaryGap : false,
data : ['周一','周二','周三','周四','周五','周六','周日'],
axisLine:{
lineStyle:{
color: '#87cefa'
},
},
axisLabel : {
interval:0,
rotate:40,
textStyle: {
color: '#fff',
fontSize:13
}
}
}
],
yAxis : [
{
type : 'value',
axisLine:{
lineStyle:{
color: '#87cefa'
},
},
splitLine: {
"show": false
},
axisLabel: {
textStyle: {
color: '#fff'
},
formatter: function (value) {
return value + "元"
},
},
}
],
series : [
{
name:'厦门第一医院',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[10, 12, 21, 54, 260, 830, 710]
},
{
name:'厦门中山医院',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[30, 182, 434, 791, 390, 30, 10]
},
{
name:'厦门中医院',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[1320, 1132, 601, 234, 120, 90, 20]
},
{
name:'厦门第五医院',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[320, 132, 61, 34, 20, 9, 2]
}
]
})
//体检人次
var lineChart2 = echarts.init(document.getElementById('lineChart2'));
lineChart2.setOption( {
color:["#87cefa","#ff7f50","#32cd32","#da70d6",],
tooltip : {
trigger: 'item',
formatter: "{a}<br/>{b}<br/>{c}人"
},
legend: {
data:['厦门第一医院','厦门中山医院','厦门中医院','厦门第五医院',],
y: 'bottom',
x:'center',
textStyle:{
color:'#fff',
fontSize:12
}
},
grid:{
left: '5%',
right: '5%',
bottom: '10%',
containLabel: true
},
calculable : true,
xAxis : [
{
type : 'category',
boundaryGap : false,
data : ['周一','周二','周三','周四','周五','周六','周日'],
axisLine:{
lineStyle:{
color: '#87cefa'
},
},
axisLabel : {
interval:0,
rotate:40,
textStyle: {
color: '#fff',
fontSize:13
}
}
}
],
yAxis : [
{
type : 'value',
axisLine:{
lineStyle:{
color: '#87cefa'
},
},
splitLine: {
"show": false
},
axisLabel: {
textStyle: {
color: '#fff'
},
formatter: function (value) {
return value + "人"
},
},
}
],
series : [
{
name:'厦门第一医院',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[120, 122, 221, 524, 460, 530, 610]
},
{
name:'厦门中山医院',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[130, 682, 534, 691, 490, 130, 110]
},
{
name:'厦门中医院',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[320, 132, 161, 134, 112, 190, 120]
},
{
name:'厦门第五医院',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[320, 132, 461, 34, 202, 93, 222]
}
]
})
//床位数量分布
var pieChart2 = echarts.init(document.getElementById('pieChart2'));
pieChart2.setOption({
color:["#87cefa","#ff7f50","#32cd32","#da70d6",],
tooltip : {
trigger: 'item',
formatter: "{a}<br/>{b}<br/>{c}床"
},
calculable : true,
series : [
{
name:'床位数量分布',
type:'pie',
radius : [30, 110],
center : ['45%', '50%'],
roseType : 'area',
x: '50%',
max: 40,
sort : 'ascending',
data:[
{value:700, name:'厦门第一医院'},
{value:500, name:'厦门中山医院'},
{value:105, name:'厦门中医院'},
{value:250, name:'厦门第五医院'},
]
}
]
})
//药占比
var histogramChart3 = echarts.init(document.getElementById('histogramChart3'));
histogramChart3.setOption( {
color:['#87cefa'],
grid:{
left: '5%',
right: '5%',
bottom: '5%',
containLabel: true
},
tooltip : {
trigger: 'item',
formatter: "{a}<br/>{b}<br/>{c}%"
},
calculable : true,
xAxis : [
{
type : 'category',
data : ['厦门第一医院','厦门中山医院','厦门中医院','厦门第五医院',],
axisLine:{
lineStyle:{
color: '#87cefa'
},
},
axisLabel : {
interval:0,
rotate:40,
textStyle: {
color: '#fff',
fontSize:13
}
}
}
],
yAxis : [
{
type : 'value',
axisLine:{
lineStyle:{
color: '#87cefa'
},
},
splitLine: {
"show": false
},
axisLabel: {
textStyle: {
color: '#fff'
},
formatter: function (value) {
return value + "%"
},
},
}
],
series : [
{
name:'药占比',
type:'bar',
barWidth:30,
data:[60,80,70,50],
},
]
});
//平均住院天数
var histogramChart4 = echarts.init(document.getElementById('histogramChart4'));
histogramChart4.setOption( {
color:['#87cefa'],
grid:{
left: '5%',
right: '5%',
bottom: '5%',
containLabel: true
},
tooltip : {
trigger: 'item',
formatter: "{a}<br/>{b}<br/>{c}天"
},
calculable : true,
xAxis : [
{
type : 'category',
data : ['厦门第一医院','厦门中山医院','厦门中医院','厦门第五医院',],
axisLine:{
lineStyle:{
color: '#87cefa'
},
},
axisLabel : {
interval:0,
rotate:40,
textStyle: {
color: '#fff',
fontSize:13
}
}
}
],
yAxis : [
{
type : 'value',
axisLine:{
lineStyle:{
color: '#87cefa'
},
},
splitLine: {
"show": false
},
axisLabel: {
textStyle: {
color: '#fff'
},
formatter: function (value) {
return value + "天"
},
},
}
],
series : [
{
name:'平均住院天数',
type:'bar',
barWidth:30,
data:[6,8,7,5],
},
]
});
}