From 4970ad75d8ead72669e1d2b8599fbcfc058126e1 Mon Sep 17 00:00:00 2001 From: ihzero Date: Tue, 26 Sep 2023 17:31:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E5=BD=A2=E5=B0=8F=E6=95=B0=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/components/pests-chart.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/index/components/pests-chart.vue b/src/pages/index/components/pests-chart.vue index 7395dcd..f21e8ee 100644 --- a/src/pages/index/components/pests-chart.vue +++ b/src/pages/index/components/pests-chart.vue @@ -144,8 +144,10 @@ export default { rotateAngle: 30, }, yAxis: { + min: 1, data: [ { + tofix: 1, min: 0, }, ], @@ -219,7 +221,7 @@ export default { } ) const { data: resData } = data - + const xAxis = [] const seriesData = [] @@ -227,7 +229,10 @@ export default { xAxis.push(key) seriesData.push(resData[key]) }) - + const max = Math.max(...seriesData) + let maxN = Math.ceil(max / 5) * 5 + maxN = maxN === 0 ? 5 : maxN + this.opts.yAxis.data[0].max = maxN let res = { categories: xAxis, series: [ @@ -235,7 +240,6 @@ export default { name: '虫情统计', data: seriesData, }, - ], } this.chartData = JSON.parse(JSON.stringify(res))