From 0a18eca2ed1ad468a9bcd520461cfa0a0ab87d95 Mon Sep 17 00:00:00 2001 From: ihzero Date: Tue, 26 Sep 2023 18:06:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/components/pests-chart.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pages/index/components/pests-chart.vue b/src/pages/index/components/pests-chart.vue index f21e8ee..5ff4d83 100644 --- a/src/pages/index/components/pests-chart.vue +++ b/src/pages/index/components/pests-chart.vue @@ -230,9 +230,15 @@ export default { 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 + + if (max > 5) { + let maxN = Math.ceil(max / 5) * 5 + maxN = maxN === 0 ? 5 : maxN + this.opts.yAxis.data[0].max = maxN + } else { + this.opts.yAxis.splitNumber = max + } + let res = { categories: xAxis, series: [