Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/visual/interaction/lineInteraction.jsp

212 lines
9.1 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<%@ page language="java" pageEncoding="UTF-8"%>
<%@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); %>
<style type="text/css">
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
.select2-selection__arrow {
margin-top: 3px;
}
</style>
<script type="text/javascript">
$(function () {
var colors = ['#75BC63', '#D12FD6', '#00c200', '#d14a61', '#675bba', '#5793f3'];
var symbols = ['circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'];
/* 请求数据 */
function getValue() {
//折线图
$.post(ext.contextPath + '/plan/getDataByPlanInteractionId.do', { planInteractionId: "${planInteractionId}" }, function (data) {
var yaAxis = [];
var series = [];
var measuredt = [];
var legendName = [];
for (var d = 0; d < data[0].mPoint.length; d++) {
var ArrayDatas = data[0].mPoint[d].mPointHistory//eval("(" + data + ")");
var offset = 60;
//y轴
var yobj = {
type: 'value',
scale: true,
name: data[0].mPoint[d].parmname + "(" + data[0].mPoint[d].unit + ")",
nameTextStyle: {
color: '#fff',
fontSize: 18
},
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: '#97C8E6',
width: 2,
}
},
axisLabel: {
color: '#fff',
formatter: '{value}' + data[0].mPoint[d].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[0].mPoint[d].parmname,
xAxisIndex: 1,
yAxisIndex: d,
symbol: symbols[d % symbols.length],
symbolSize: 10,
itemStyle: {
color: colors[d % colors.length],
borderWidth: 1,
},
lineStyle: {
width: 3,
},
};
sobj.type = "line";
//legend名称
legendName.push(data[0].mPoint[d].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.getElementById("modalDialog").style.height = 0.7 * document.documentElement.offsetHeight +"px";
document.getElementById("modalDialog").style.width = 0.5 * document.documentElement.offsetWidth + "px";
document.getElementById("barline").style.height = 0.97*$("#modalDialog").height() +"px";
document.getElementById("barline").style.width = 0.97*$("#modalDialog").width()+ "px";
// console.log("modalContentHeight",document.getElementById("modalDialog").offsetHeight);
// console.log("modalContentWidth",document.getElementById("modalDialog").offsetWidth);
// console.log("modalContentHeight2",$("#modalDialog").height());
// console.log("modalContentWidth2",$("#modalDialog").width());
getValue();
//console.log("height",document.body.scrollHeight);
});
})
</script>
<div class="modal fade" id="subModal" style="width:100%;height:100%">
<div id="modalDialog" class="modal-dialog" style="width:50%;height:70%">
<div id="modalContent" class="modal-content" style="width:100%;height:100%">
<div class="modal-body" style="background-color: #182F52;width:100%;height:100%;">
<div id="barline" style="width:100%;height: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: '5%',
top: '10%',
},
legend: {
left: 'center',
itemGap: 100,
textStyle: {
color: '#fff',
fontSize: 20
},
//data: ['出水量', '1#压力', '2#压力']
},
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']
},
{
type: 'category',
show: false,
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: [],
series: []
};
</script>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>