添加振动监控图表

master
夜笙歌 2 months ago
parent eda254a346
commit 3ed7c62796

@ -1,11 +1,17 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<head> <head>
<th:block th:include="include :: header('振动数据曲线')"/> <th:block th:include="include :: header('振动数据曲线')"/>
<th:block th:include="include :: layout-latest-css"/> <th:block th:include="include :: layout-latest-css"/>
<th:block th:include="include :: ztree-css"/> <th:block th:include="include :: ztree-css"/>
<th:block th:include="include :: datetimepicker-css"/> <th:block th:include="include :: datetimepicker-css"/>
</head> </head>
<style>
.echarts{
width: 49%;
display: inline-block;
}
</style>
<body class="gray-bg"> <body class="gray-bg">
<div class="ui-layout-west"> <div class="ui-layout-west">
@ -15,14 +21,16 @@
<i class="fa icon-grid"></i> 测控点信息 <i class="fa icon-grid"></i> 测控点信息
</div> </div>
<div class="box-tools pull-right"> <div class="box-tools pull-right">
<a type="button" class="btn btn-box-tool" href="#" onclick="dept()" title="测控点信息"><i class="fa fa-edit"></i></a> <a class="btn btn-box-tool" href="#" onclick="dept()" title="测控点信息" type="button"><i class="fa fa-edit"></i></a>
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button> <button class="btn btn-box-tool" id="btnExpand" style="display:none;" title="展开" type="button"><i
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button> class="fa fa-chevron-up"></i></button>
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新"><i class="fa fa-refresh"></i></button> <button class="btn btn-box-tool" id="btnCollapse" title="折叠" type="button"><i class="fa fa-chevron-down"></i>
</button>
<button class="btn btn-box-tool" id="btnRefresh" title="刷新" type="button"><i class="fa fa-refresh"></i></button>
</div> </div>
</div> </div>
<div class="ui-layout-content"> <div class="ui-layout-content">
<div id="tree" class="ztree"></div> <div class="ztree" id="tree"></div>
</div> </div>
</div> </div>
</div> </div>
@ -32,13 +40,17 @@
<div class="row"> <div class="row">
<div class="col-sm-12 search-collapse"> <div class="col-sm-12 search-collapse">
<form id="formId"> <form id="formId">
<input type="hidden" id="monitorId" name="monitorId"> <input id="monitorId" name="monitorId" type="hidden">
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li class="select-time"> <li class="select-time">
<label>采集时间:</label><input type="text" class="form-control" style="width: 150px" id="laydate-demo-3" placeholder="开始时间" name="params[beginCollectTime]"/> <label>采集时间:</label><input class="form-control" id="laydate-demo-3" name="params[beginCollectTime]"
placeholder="开始时间"
style="width: 150px" type="text"/>
<span>-</span> <span>-</span>
<input type="text" class="form-control" id="laydate-demo-4" style="width: 150px" placeholder="结束时间" name="params[endCollectTime]"/> <input class="form-control" id="laydate-demo-4" name="params[endCollectTime]" placeholder="结束时间"
style="width: 150px"
type="text"/>
</li> </li>
<li> <li>
<!-- <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search();"><i class="fa fa-search"></i>&nbsp;搜索</a>--> <!-- <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search();"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
@ -51,10 +63,10 @@
</form> </form>
</div> </div>
<div class="ibox-content" style="margin-top: 80px;margin-right: 0px;"> <div class="ibox-content" style="margin-top: 80px;margin-right: 0px;">
<div class="echarts" id="echarts-line-chart" style="height: 620px"></div> <div class="echarts" id="echarts-line-chart" style="height: 40vh"></div>
</div> <div class="echarts" id="echarts-line-chart1" style="height: 40vh"></div>
<div class="col-sm-12 select-table table-striped"> <div class="echarts" id="echarts-line-chart2" style="height: 40vh"></div>
<table id="bootstrap-table"></table> <div class="echarts" id="echarts-line-chart3" style="height: 40vh"></div>
</div> </div>
</div> </div>
</div> </div>
@ -65,11 +77,10 @@
<th:block th:include="include :: ztree-js"/> <th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: echarts-js"/> <th:block th:include="include :: echarts-js"/>
<th:block th:include="include :: datetimepicker-js"/> <th:block th:include="include :: datetimepicker-js"/>
<script src="../../../js/common/echarts.min.js"></script>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "report/temandhumreport" var prefix = ctx + "report/temandhumreport"
var timedata = []; var timedata = [];
var tempreturedata = []; var tempreturedata = [];
@ -109,7 +120,7 @@
function queryUserList() { function queryUserList() {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
modalName: "压缩空气实时数据", modalName: "压缩空气数据曲线",
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
@ -157,8 +168,7 @@
$.table.init(options); $.table.init(options);
} }
function queryDeptTree() function queryDeptTree() {
{
var url = ctx + "system/Monitor/treeData?monitorType=20"; var url = ctx + "system/Monitor/treeData?monitorType=20";
var options = { var options = {
url: url, url: url,
@ -204,7 +214,7 @@
formData.append("startTime", $("#laydate-demo-3").val()); formData.append("startTime", $("#laydate-demo-3").val());
formData.append("endTime", $("#laydate-demo-4").val()); formData.append("endTime", $("#laydate-demo-4").val());
$.ajax({ $.ajax({
url: prefix + "/getdata", url: ctx + "system/TVibrationsensorData/sensorList",
type: 'post', type: 'post',
cache: false, cache: false,
data: formData, data: formData,
@ -212,141 +222,20 @@
contentType: false, contentType: false,
dataType: "json", dataType: "json",
success: function (result) { success: function (result) {
console.log(result); design(result.data);
result.data.forEach(function(e){
// console.log(e.fluxData);
timedata.push(e.collectTime);
tempreturedata.push(e.tempreture);
humdata.push(e.humidity);
});
design();
} }
}); });
} }
function design() { function design(e) {
var lineChart = echarts.init(document.getElementById("echarts-line-chart")); console.log(e)
// var lineoption = { let lineChart = echarts.init(document.getElementById("echarts-line-chart"));
// title: { let lineChart1 = echarts.init(document.getElementById("echarts-line-chart1"));
// text: '温湿度实时数据', let lineChart2 = echarts.init(document.getElementById("echarts-line-chart2"));
// left: 'center' let lineChart3 = echarts.init(document.getElementById("echarts-line-chart3"));
// }, lineChart.setOption({
// tooltip: {
// trigger: 'axis',
// axisPointer: {
// animation: false
// }
// },
// legend: {
// data: ['温度', '湿度'],
// left: 10
// },
// toolbox: {
// feature: {
// dataZoom: {
// yAxisIndex: 'none'
// },
// restore: {},
// saveAsImage: {}
// }
// },
// axisPointer: {
// link: {xAxisIndex: 'all'}
// },
// dataZoom: [
// {
// show: true,
// realtime: true,
// start: 0,
// end: 100,
// xAxisIndex: [0, 1]
// },
// {
// type: 'inside',
// realtime: true,
// start: 30,
// end: 70,
// xAxisIndex: [0, 1]
// }
// ],
// grid: [{
// left: 50,
// right: 50,
// height: '35%'
// }, {
// left: 50,
// right: 50,
// top: '55%',
// height: '35%'
// }],
// xAxis: [
// {
// type: 'category',
// boundaryGap: false,
// axisLine: {onZero: true},
// data: timedata
// },
// {
// gridIndex: 1,
// type: 'category',
// boundaryGap: false,
// axisLine: {onZero: true},
// data: timedata,
// position: 'top'
// }
//
// ],
// yAxis: [
// {
// name: '温度',
// type: 'value'
//
// },
// {
// gridIndex: 1,
// name: '湿度',
// type: 'value',
// inverse: true
// }
// ],
// series: [
//
// {
// name: '温度',
// type: 'line',
// symbolSize: 8,
// hoverAnimation: false,
// data:tempreturedata,
// smooth: true,
// markPoint : {
// data : [
// {type : 'max', name: '最大值'},
// {type : 'min', name: '最小值'}
// ]
// },
// },
// {
// name: '湿度',
// type: 'line',
// xAxisIndex: 1,
// yAxisIndex: 1,
// symbolSize: 8,
// hoverAnimation: false,
// data:humdata,
// smooth: true,
// markPoint : {
// data : [
// {type : 'max', name: '最大值'},
// {type : 'min', name: '最小值'}
// ]
// },
// }
// ]
// };
var lineoption = {
title: { title: {
text: '温度实时数据', text: '温度数据曲线(℃)',
left: 'center' left: 'center'
}, },
tooltip: { tooltip: {
@ -359,17 +248,50 @@
data: ['温度'], data: ['温度'],
left: 10 left: 10
}, },
toolbox: { dataZoom: [
feature: { {
dataZoom: { show: true,
yAxisIndex: 'none' realtime: true,
start: 0,
end: 100,
xAxisIndex: 0
}, },
restore: {}, {
saveAsImage: {} type: 'inside',
realtime: true,
start: 30,
end: 70,
xAxisIndex: 0
}
],
xAxis: {
type: 'category',
data: e.map(v=>v.collectTime)
},
yAxis: {
type: 'value'
},
series: [
{
data: e.map(v=>v.temperature),
type: 'line'
} }
]
});
lineChart1.setOption({
title: {
text: '速度数据曲线(mm/s)',
left: 'center'
}, },
tooltip: {
trigger: 'axis',
axisPointer: { axisPointer: {
link: { xAxisIndex: 'all' } animation: false
}
},
legend: {
data: ['速度'],
left: 10
}, },
dataZoom: [ dataZoom: [
{ {
@ -387,45 +309,115 @@
xAxisIndex: 0 xAxisIndex: 0
} }
], ],
grid: { xAxis: {
left: 50, type: 'category',
right: 50, data: e.map(v=>v.collectTime)
height: '60%' // 调整height值以适应图表位置
}, },
yAxis: {
type: 'value'
},
series: [
{
data: e.map(v=>v.speed),
type: 'line'
}
]
}, true);
lineChart2.setOption({
title: {
text: '位移数据曲线(um)',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
animation: false
}
},
legend: {
data: ['位移'],
left: 10
},
dataZoom: [
{
show: true,
realtime: true,
start: 0,
end: 100,
xAxisIndex: 0
},
{
type: 'inside',
realtime: true,
start: 30,
end: 70,
xAxisIndex: 0
}
],
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false, data: e.map(v=>v.collectTime)
axisLine: { onZero: true },
data: timedata
}, },
yAxis: { yAxis: {
name: '温度',
type: 'value' type: 'value'
}, },
series: [ series: [
{ {
name: '温度', data: e.map(v=>v.displacement),
type: 'line', type: 'line'
symbolSize: 8, }
hoverAnimation: false,
data: tempreturedata,
smooth: true,
markPoint: {
data: [
{ type: 'max', name: '最大值' },
{ type: 'min', name: '最小值' }
] ]
}, true);
lineChart3.setOption({
title: {
text: '加速度数据曲线(g)',
left: 'center'
}, },
tooltip: {
trigger: 'axis',
axisPointer: {
animation: false
}
},
legend: {
data: ['加速度'],
left: 10
},
dataZoom: [
{
show: true,
realtime: true,
start: 0,
end: 100,
xAxisIndex: 0
},
{
type: 'inside',
realtime: true,
start: 30,
end: 70,
xAxisIndex: 0
}
],
xAxis: {
type: 'category',
data: e.map(v=>v.collectTime)
},
yAxis: {
type: 'value'
},
series: [
{
data: e.map(v=>v.acceleration),
type: 'line'
} }
] ]
}; }, true);
lineChart.setOption(lineoption,true);
$(window).resize(lineChart.resize); $(window).resize(lineChart.resize);
timedata.splice(0,timedata.length); $(window).resize(lineChart1.resize);
tempreturedata.splice(0,tempreturedata.length); $(window).resize(lineChart2.resize);
humdata.splice(0,humdata.length); $(window).resize(lineChart3.resize);
//console.log(timedata)
} }
</script> </script>
</body> </body>

Loading…
Cancel
Save