Commit 3d828049 authored by LiXiaoYi's avatar LiXiaoYi

fix:转矩变量取值不正确

parent 6edfc55e
......@@ -2,17 +2,17 @@ let baseUrl = 'http://183.24.11.2:8802/api/'
//图表1
getIndicators()
setInterval(()=>{
setInterval(() => {
getIndicators()
}, 1000)
function getIndicators(){
function getIndicators () {
$.ajax({
type :"POST",
url : baseUrl + "/Base/PostRediusTest",
dataType :"json",
type: "POST",
url: baseUrl + "/Base/PostRediusTest",
dataType: "json",
contentType: "application/json",
data: JSON.stringify( ["PRO_EFF","PRO_EFF","ACT_EFF"]),
success :function(res) {
data: JSON.stringify(["PRO_EFF", "PRO_EFF", "ACT_EFF"]),
success: function (res) {
document.getElementById('pro_eff').innerText = res.data[0].Value
document.getElementById('per_eff').innerText = res.data[1].Value
document.getElementById('act_eff').innerText = res.data[2].Value
......@@ -22,7 +22,7 @@ function getIndicators(){
//图表2
getProcess()
function getProcess(){
function getProcess () {
let mycharts = echarts.init(document.getElementById('act_torque'))
let name = ['电机功率1', '电机功率2', '电机功率3', '电机功率4', '电机功率5']
let option = {
......@@ -61,13 +61,13 @@ function getProcess(){
inverse: true,
data: name,
axisLine: {
show: false
show: false
},
splitLine: {
show: false
show: false
},
axisTick: {
show: false
show: false
},
axisLabel: {
interval: 0,
......@@ -77,16 +77,16 @@ function getProcess(){
verticalAlign: 'center',
lineHeight: 40,
fontSize: 14,
formatter: function(value) {
formatter: function (value) {
return Number(value) ? value : 0
},
}
}],
series: [{
type: 'bar',
data: [0,0,0,0,0],
data: [0, 0, 0, 0, 0],
showBackground: true,
backgroundStyle:{
backgroundStyle: {
color: '#0C2648'
},
yAxisIndex: 0,
......@@ -102,19 +102,19 @@ function getProcess(){
mycharts.setOption(option)
setInterval(function () {
$.ajax({
type :"POST",
url : baseUrl + "/Base/PostRediusTest",
dataType :"json",
type: "POST",
url: baseUrl + "/Base/PostRediusTest",
dataType: "json",
contentType: "application/json",
data: JSON.stringify( ["ACT_TORQUE1","ACT_TORQUE2","ACT_TORQUE3","ACT_TORQUE4", "ACT_TORQUE5"]),
success :function(res) {
data: JSON.stringify(["ACT_TORQUE1", "ACT_TORQUE2", "ACT_TORQUE3", "ACT_TORQUE4", "ACT_TORQUE5"]),
success: function (res) {
let data = []
name.forEach((item, i)=>{
name.forEach((item, i) => {
data.push(res.data[i].Value ? res.data[i].Value : 0)
})
mycharts.setOption({
yAxis: [
{},{
{}, {
data: data
}
],
......@@ -131,7 +131,7 @@ function getProcess(){
//图表3
getTorque()
function getTorque(){
function getTorque () {
let mycharts = echarts.init(document.getElementById('torque'))
let xAxis = []
let data1 = []
......@@ -140,19 +140,19 @@ function getTorque(){
let color = ['#2E86DF', '#F5BD5F'];
let option = {
color: color,
grid:{
grid: {
top: 40,
right: 10,
bottom: 0,
left: 10,
containLabel: true
},
legend:{
legend: {
right: 0,
icon: 'rect',
itemWidth: 20,
itemHeight: 2,
textStyle:{
textStyle: {
color: '#fff'
}
},
......@@ -182,7 +182,7 @@ function getTorque(){
},
splitLine: {
show: true,
lineStyle:{
lineStyle: {
color: 'rgba(50, 71, 106, .4)'
}
},
......@@ -222,24 +222,24 @@ function getTorque(){
fontWeight: 500,
fontSize: 14
}
},{
}, {
type: 'scatter',
stack: '1',
symbolOffset: [-11, 0], //相对于原本位置的偏移量
data: dataScatter,
label: {
normal: {
show: false,
}
normal: {
show: false,
}
},
symbolSize: 6,
itemStyle: {
normal: {
color: color[0]
}
normal: {
color: color[0]
}
},
z: 2
},{
}, {
type: 'scatter',
stack: '2',
symbolOffset: [11, 0], //相对于原本位置的偏移量
......@@ -260,37 +260,38 @@ function getTorque(){
]
};
mycharts.setOption(option)
setInterval(()=>{
setInterval(() => {
$.ajax({
type :"POST",
url : baseUrl + "/Base/PostRediusTest",
dataType :"json",
type: "POST",
url: baseUrl + "/Base/PostRediusTest",
dataType: "json",
contentType: "application/json",
data: JSON.stringify( ["PROWER1", "PROWER2"]),
success :function(res) {
if(xAxis.length === 6){
data: JSON.stringify(["PROWER1", "PROWER2"]),
success: function (res) {
if (xAxis.length === 6) {
data1.shift()
data2.shift()
xAxis.shift()
dataScatter.shift()
dataScatter.shift()
}
console.log(res)
data1.push(res.data[0].Value)
data2.push(res.data[1].Value)
dataScatter.push(0)
// let now = new Date();
xAxis.push(/* now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() */dayjs(new Date()).format('HH:mm:ss'))
mycharts.setOption({
xAxis:{
xAxis: {
data: xAxis
},
series: [
{
data: data1
},{
}, {
data: data2
},{
}, {
data: dataScatter
},{
}, {
data: dataScatter
}
]
......@@ -316,7 +317,7 @@ function getRight1 () {
legend: {
data: legendData,
textStyle: {
color:'#fff'
color: '#fff'
},
right: 0,
},
......@@ -344,7 +345,7 @@ function getRight1 () {
yAxis: [{
type: 'value',
axisTick: {
show:false
show: false
},
axisLabel: {
color: '#fff'
......@@ -392,31 +393,31 @@ function getRight1 () {
]
}
rightChart1.setOption(rightOption1)
setInterval(()=>{
setInterval(() => {
$.ajax({
type :"POST",
url : baseUrl + "/Base/PostRediusTest",
dataType :"json",
type: "POST",
url: baseUrl + "/Base/PostRediusTest",
dataType: "json",
contentType: "application/json",
data: JSON.stringify( ["TORQUE1", "TORQUE2"]),
success :function(res) {
if(xData.length === 6){
data: JSON.stringify(["TORQUE1", "TORQUE2"]),
success: function (res) {
if (xData.length === 6) {
seriesData1.shift()
seriesData2.shift()
xData.shift()
}
seriesData1.push(res.data[0].Value ? res.data[0].Value : 0)
seriesData2.push(res.data[1].Value ? res.data[0].Value : 0)
seriesData2.push(res.data[1].Value ? res.data[1].Value : 0)
// let now = new Date();
xData.push(/* now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() */ dayjs(new Date()).format('HH:mm:ss'))
rightChart1.setOption({
xAxis:{
xAxis: {
data: xData
},
series: [
{
data: seriesData1
},{
}, {
data: seriesData2
}
]
......@@ -429,11 +430,11 @@ function getRight1 () {
/* 右侧第二个 */
getRight2()
function getRight2() {
function getRight2 () {
let rightChart2 = echarts.init(document.getElementById('right2'));
let xData = ['电机转矩1', '电机转矩2', '电机转矩3', '电机转矩4', '电机转矩5']
let valueData = []
let rightOption2= {
let rightOption2 = {
// tooltip: {
// trigger: 'axis',
// axisPointer: {
......@@ -497,7 +498,7 @@ function getRight2() {
{
barWidth: 4,
showBackground: true,
backgroundStyle:{
backgroundStyle: {
color: '#0C2648'
},
type: 'bar',
......@@ -517,19 +518,19 @@ function getRight2() {
rightChart2.setOption(rightOption2);
setInterval(function () {
$.ajax({
type :"POST",
url : baseUrl + "/Base/PostRediusTest",
dataType :"json",
type: "POST",
url: baseUrl + "/Base/PostRediusTest",
dataType: "json",
contentType: "application/json",
data: JSON.stringify( ["ACT_TORQUE1","ACT_TORQUE2","ACT_TORQUE3","ACT_TORQUE4", "ACT_TORQUE5"]),
success :function(res) {
data: JSON.stringify(["ACT_TORQUE1", "ACT_TORQUE2", "ACT_TORQUE3", "ACT_TORQUE4", "ACT_TORQUE5"]),
success: function (res) {
let data = []
xData.forEach((item, i)=>{
xData.forEach((item, i) => {
data.push(res.data[i].Value ? res.data[i].Value : 0)
})
rightChart2.setOption({
yAxis: [
{},{
{}, {
data: data
}
],
......@@ -550,17 +551,17 @@ setInterval(() => {
getRight3()
}, 1000)
let alarmItem = []
function getRight3() {
function getRight3 () {
let alarm = document.getElementById('alarm')
let alarmData = document.getElementById('alarmData')
$.ajax({
type :"POST",
url : baseUrl + "/HMI/HMI_GstAlarms",
dataType :"json",
type: "POST",
url: baseUrl + "/HMI/HMI_GstAlarms",
dataType: "json",
contentType: "application/json",
// '【报警时间】【报警变量】【报警地址】【报警类别】【报警组】【报警设备】【报警文本】【报警值】'
data: JSON.stringify({Lang: 'Main_Language_ZH', AlarmFormat: '【报警时间】【报警变量】【报警地址】【报警类别】【报警组】【报警设备】【报警文本】', Variables: ["A1", "B1", "E1", "G1", "in_A1", "in_B1", "in_E1", "in_G1"] }),
success :function(res) {
data: JSON.stringify({ Lang: 'Main_Language_ZH', AlarmFormat: '【报警时间】【报警变量】【报警地址】【报警类别】【报警组】【报警设备】【报警文本】', Variables: ["A1", "B1", "E1", "G1", "in_A1", "in_B1", "in_E1", "in_G1"] }),
success: function (res) {
// console.log("res",res)
alarmData.innerText = res.data.length
let str = ``
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment