添加振动监控图表

master
夜笙歌 2 months ago
parent 2c438739c1
commit 8cb779c965

@ -130,13 +130,13 @@
$.post(ctx + 'system/TVibrationsensorData/realTimeMonitor', {sensorId: treeNode.id}, (e) => { $.post(ctx + 'system/TVibrationsensorData/realTimeMonitor', {sensorId: treeNode.id}, (e) => {
if (e.code === 0) { if (e.code === 0) {
let data = e.data || [] let data = e.data || []
let html = '' $("#chartDivs").html('')
data.forEach(v => { data.forEach((v, k) => {
html += ` let html = `
<div class="chartDiv" id="chartDiv"> <div class="chartDiv" id="chartDiv">
<div class="title">${v.monitorName}</div> <div class="title">${v.monitorName}</div>
<div class="time">${v.collectTime}</div> <div class="time">${v.collectTime}</div>
<div class="chart" id="chart"> <div class="chart" id="chart${k}">
</div> </div>
<div class="mileage"> <div class="mileage">
${v.displacement.toString().split('').map(vv => { ${v.displacement.toString().split('').map(vv => {
@ -146,10 +146,9 @@
<div class="text">位移(um)</div> <div class="text">位移(um)</div>
</div> </div>
` `
}) $("#chartDivs").append(html)
$("#chartDivs").html(html)
let chart = echarts.init(document.getElementById('chart')) let chart = echarts.init(document.getElementById(`chart${k}`))
let option = { let option = {
series: [ series: [
@ -163,9 +162,10 @@
}, },
center: ['25%', '50%'], center: ['25%', '50%'],
radius: '90%', radius: '90%',
max: Math.ceil(v.speed / 100) * 100,
data: [ data: [
{ {
value: 21, value: v.speed,
name: '速度(mm/s)', name: '速度(mm/s)',
title: { title: {
offsetCenter: [0, '-20%'], offsetCenter: [0, '-20%'],
@ -192,7 +192,7 @@
}, },
data: [ data: [
{ {
value: 32, value: v.temperature,
name: '温度(℃)', name: '温度(℃)',
detail: { detail: {
fontSize: 12, fontSize: 12,
@ -203,6 +203,7 @@
] ]
}; };
chart.setOption(option) chart.setOption(option)
})
} }
}) })
} }

Loading…
Cancel
Save