fix:温度监测数据图表y轴从最小值开始
This commit is contained in:
parent
235e221606
commit
67b6678033
|
@ -113,7 +113,6 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleClick(val){
|
handleClick(val){
|
||||||
console.log('handleClick',val)
|
|
||||||
let that = this;
|
let that = this;
|
||||||
that.mpointList.forEach(item=>{
|
that.mpointList.forEach(item=>{
|
||||||
if(item.nickname == that.activeName){
|
if(item.nickname == that.activeName){
|
||||||
|
@ -128,11 +127,22 @@ export default {
|
||||||
params.timex__lte = that.endTime;
|
params.timex__lte = that.endTime;
|
||||||
params.page = 0;
|
params.page = 0;
|
||||||
that.$API.enm.mplogx.req(params).then((res) => {
|
that.$API.enm.mplogx.req(params).then((res) => {
|
||||||
|
let xAxisData = [],seriesData = [];
|
||||||
res.forEach(item=>{
|
res.forEach(item=>{
|
||||||
that.option.xAxis.data.unshift(item.timex);
|
xAxisData.unshift(item.timex);
|
||||||
let value = Number(item.val_float).toFixed(3);
|
let value = Number(item.val_float).toFixed(3);
|
||||||
that.option.series.data.unshift(value);
|
seriesData.unshift(value);
|
||||||
})
|
})
|
||||||
|
function getMinValue(arr) {
|
||||||
|
return Math.min.apply(null, arr);
|
||||||
|
}
|
||||||
|
if(that.activeName.indexOf("温度") != -1){
|
||||||
|
let minNum = getMinValue(seriesData);
|
||||||
|
console.log(minNum);
|
||||||
|
that.option.yAxis.min = minNum;
|
||||||
|
}
|
||||||
|
that.option.xAxis.data = xAxisData;
|
||||||
|
that.option.series.data = seriesData;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue