From d83944f00dbb44677561bbb04ded83c9995a2e31 Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 9 Jan 2026 15:55:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=A6=85=E9=81=93294?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/monitor_detail.vue | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/views/wpm_bx/monitor_detail.vue b/src/views/wpm_bx/monitor_detail.vue index 9e25c1ca..406ebdbf 100644 --- a/src/views/wpm_bx/monitor_detail.vue +++ b/src/views/wpm_bx/monitor_detail.vue @@ -81,6 +81,8 @@ export default { }, yAxis: { type: "value", + min: 0, + max: 100 }, series:{ name: "数据检测", @@ -134,14 +136,10 @@ export default { let value = Number(item.val_float).toFixed(3); 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; - } + let minNum = seriesData.reduce((a, b) => a < b ? a : b); + let maxNum = Math.max(...seriesData); + that.option.yAxis.min = minNum; + that.option.yAxis.max = maxNum; that.option.xAxis.data = xAxisData; that.option.series.data = seriesData; })