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))