图形小数点

wechat
ihzero 2023-09-26 17:31:04 +08:00
parent 1d943e1957
commit 4970ad75d8
1 changed files with 7 additions and 3 deletions

View File

@ -144,8 +144,10 @@ export default {
rotateAngle: 30, rotateAngle: 30,
}, },
yAxis: { yAxis: {
min: 1,
data: [ data: [
{ {
tofix: 1,
min: 0, min: 0,
}, },
], ],
@ -219,7 +221,7 @@ export default {
} }
) )
const { data: resData } = data const { data: resData } = data
const xAxis = [] const xAxis = []
const seriesData = [] const seriesData = []
@ -227,7 +229,10 @@ export default {
xAxis.push(key) xAxis.push(key)
seriesData.push(resData[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 = { let res = {
categories: xAxis, categories: xAxis,
series: [ series: [
@ -235,7 +240,6 @@ export default {
name: '虫情统计', name: '虫情统计',
data: seriesData, data: seriesData,
}, },
], ],
} }
this.chartData = JSON.parse(JSON.stringify(res)) this.chartData = JSON.parse(JSON.stringify(res))