修改charts图
This commit is contained in:
parent
7a98ad2bd3
commit
e6c6e2fbf0
@ -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 '东北'
|
||||
|
Loading…
x
Reference in New Issue
Block a user