添加振动监控图表

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

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

Loading…
Cancel
Save