first commit
This commit is contained in:
247
WebRoot/jsp/visual/modules/bar.jsp
Normal file
247
WebRoot/jsp/visual/modules/bar.jsp
Normal file
@ -0,0 +1,247 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<%@page import="com.sipai.entity.visual.JspElement"%>
|
||||
<%request.setAttribute("Type_GetValue", JspElement.Type_GetValue); %>
|
||||
<%request.setAttribute("Type_GetHistory", JspElement.Type_GetHistory); %>
|
||||
<%request.setAttribute("Type_GetModbus", JspElement.Type_GetModbus); %>
|
||||
<%request.setAttribute("Type_GetHttp", JspElement.Type_GetHttp); %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
|
||||
<head>
|
||||
<title></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var colors = ['#75BC63','#D12FD6','#00c200', '#d14a61', '#675bba', '#5793f3'];
|
||||
var symbols = ['circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'];
|
||||
/* 请求数据 */
|
||||
function getValue() {
|
||||
//折线图
|
||||
$.post(ext.contextPath + '/plan/getJspWholeInfoByPlanLayoutId.do', { planLayoutId: "${param.planLayoutId}" }, function (data) {
|
||||
//console.log("data", data);
|
||||
var yaAxis = [];
|
||||
var series = [];
|
||||
var measuredt = [];
|
||||
var legendName = [];
|
||||
for (var d = 0; d < data.length; d++) {
|
||||
if (data[d].getValueType == '${Type_GetHistory}') {
|
||||
var ArrayDatas = data[d].mPointHistory//eval("(" + data + ")");
|
||||
var offset = 60;
|
||||
|
||||
//y轴
|
||||
var yobj = {
|
||||
type: 'value',
|
||||
scale: true,
|
||||
name: data[d].name + "(" + data[d].mPoint.unit + ")",//data[d].mPoint.parmname
|
||||
nameTextStyle: {
|
||||
color: '#fff',
|
||||
fontSize: 18
|
||||
},
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#97C8E6',
|
||||
width: 2,
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#fff',
|
||||
formatter: '{value}' + data[d].mPoint.unit,
|
||||
},
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
//max: 1200,
|
||||
min: function (value) {
|
||||
return value.min;
|
||||
},
|
||||
boundaryGap: [0.2, 0.2]
|
||||
}
|
||||
if (d == 0) {
|
||||
yobj.position = 'left';
|
||||
yobj.offset = 0;
|
||||
} else {
|
||||
yobj.position = 'right';
|
||||
yobj.offset = offset * (d - 1);
|
||||
}
|
||||
if (d >= 2) {
|
||||
yobj.show = false;
|
||||
}
|
||||
yaAxis.push(yobj);
|
||||
|
||||
//series
|
||||
var sobj = {
|
||||
name: data[d].name,//data[d].mPoint.parmname
|
||||
xAxisIndex: 1,
|
||||
yAxisIndex: d,
|
||||
symbol: symbols[d % symbols.length],
|
||||
symbolSize: 10,
|
||||
itemStyle: {
|
||||
color: colors[d % colors.length],
|
||||
borderWidth: 1,
|
||||
},
|
||||
lineStyle: {
|
||||
width: 3,
|
||||
},
|
||||
};
|
||||
|
||||
if (data[d].style != null && data[d].style != "") {
|
||||
sobj.type = data[d].style;
|
||||
} else {
|
||||
sobj.type = "line";
|
||||
}
|
||||
//legend名称
|
||||
legendName.push(data[d].name);//data[d].mPoint.parmname
|
||||
var dataSeries = [];
|
||||
for (var j = 0; j < ArrayDatas.length; j++) {
|
||||
//x轴 只取data第一条数据进行生成x轴
|
||||
if(d == 0){
|
||||
measuredt.push(ArrayDatas[j].measuredt.substring(5, 10) + "-" + ArrayDatas[j].measuredt.substring(11, 13));
|
||||
}
|
||||
dataSeries.push(ArrayDatas[j].parmvalue);
|
||||
}
|
||||
sobj.data = dataSeries;
|
||||
series.push(sobj);
|
||||
}
|
||||
}
|
||||
//赋值 x轴 y轴 series
|
||||
optionBL.legend.data = legendName;
|
||||
optionBL.xAxis[0].data = measuredt;
|
||||
optionBL.yAxis = yaAxis;
|
||||
optionBL.series = series;
|
||||
//图标加载
|
||||
//console.log("option",optionBL);
|
||||
BLChart.setOption(optionBL);
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
/* 定时器 */
|
||||
setInterval(getValue, 300000); //<!--每隔5分钟刷新一次-->
|
||||
//setInterval(change, 60000); //每1分钟切换
|
||||
|
||||
/* 初始化 */
|
||||
$(function () {
|
||||
document.body.style.backgroundColor = "#" + '${param.backgroundColor}';
|
||||
|
||||
//getValue();
|
||||
//console.log("height",document.body.scrollHeight);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body style="width:100%;height:100%;margin:0;padding:0;overflow-x:hidden;overflow-y:hidden">
|
||||
<div id="barline" style="height:95%;width:100%"></div>
|
||||
<script language="JavaScript">
|
||||
/* 构造图表 */
|
||||
var BLChart = echarts.init(document.getElementById('barline'));
|
||||
optionBL = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
label: {
|
||||
backgroundColor: '#283b56'
|
||||
}
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '5%',
|
||||
right: '5%',
|
||||
bottom: '7%',
|
||||
top: '10%',
|
||||
},
|
||||
legend: {
|
||||
left: 'center',
|
||||
itemGap: 100,
|
||||
textStyle: {
|
||||
color: '#fff',
|
||||
fontSize: 20
|
||||
},
|
||||
data: ['称量件数']
|
||||
},
|
||||
dataZoom: {
|
||||
show: false,
|
||||
start: 0,
|
||||
end: 100
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#97C8E6',
|
||||
width: 2,
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#fff'
|
||||
},
|
||||
boundaryGap: true,
|
||||
data: ['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
|
||||
},
|
||||
],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
scale: true,
|
||||
name: '件',
|
||||
nameTextStyle: {
|
||||
color: '#fff',
|
||||
fontSize: 18
|
||||
},
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#97C8E6',
|
||||
width: 2,
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#fff'
|
||||
},
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
//max: 1200,
|
||||
min: 0,
|
||||
boundaryGap: [0.2, 0.2]
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '称量件数',
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
color: '#426AB2',
|
||||
},
|
||||
data: (function () {
|
||||
var res = [];
|
||||
var len = 24;
|
||||
while (len--) {
|
||||
res.push(Math.round(Math.random() * 1000));
|
||||
}
|
||||
return res;
|
||||
})()
|
||||
},
|
||||
|
||||
]
|
||||
};
|
||||
BLChart.setOption(optionBL);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user