修改charts图

This commit is contained in:
home孙 2025-07-18 09:40:17 +08:00
parent 7a98ad2bd3
commit e6c6e2fbf0

View File

@ -10,7 +10,7 @@
<view class="content">
<view class="number">
{{ echartName == '风向' ? getWindDirection(valuePH) : (valuePH + unit) }}
{{ echartName == '风向' ? getWindDirection(valuePH) : valuePH!='暂无数据'?(valuePH + unit):valuePH}}
</view>
<view class="data_analysis">
<image src="../../static/data_analysis.png" mode=""></image>
@ -103,22 +103,30 @@
},
onLoad(option) {
// console.log(option);
if (option.id) {
console.log(option);
if (option.id&&option.id!='undefined') {
this.equipmentId = option.id
}
if (option.data) {
if (option.data&&option.data!='undefined') {
this.valuePH = option.data
}else{
this.valuePH='暂无数据'
}
if (option.name) {
if (option.name&&option.name!='undefined') {
this.echartName = option.name
}else{
this.echartName='暂无数据'
}
if (option.unit) {
if (option.unit&&option.unit!='undefined') {
this.unit = option.unit
this.opts.yAxis.data[0].title = option.unit
}else{
this.unit=''
}
if(option.equipmentName){
if(option.equipmentName&&option.equipmentName!='undefined'){
this.equipmentName = option.equipmentName
}else{
this.equipmentName=''
}
if(option.flag){
this.flag = option.flag
@ -146,9 +154,25 @@
this.chartData = JSON.parse(JSON.stringify(res));
}, 500);
},
getServerData1() {
//
//
let res = {
categories: [],
series: [{
name: '暂无数据',
data: []
}, ]
};
this.chartData = JSON.parse(JSON.stringify(res));
},
// 线
getEchartsData() {
if(!this.equipmentId||this.equipmentId=='undefined'){
this.getServerData1();
return
}
if(this.flag == 1){
this.$http({
@ -235,6 +259,9 @@
//
getWindDirection(number){
if(number=='暂无数据'){
return '暂无数据'
}
let num = Number(number)
if(num <= 67 && num >= 22 ){
return '东北'