修改echart y轴处理方案
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
const dataProcessing = (arr: any[]) => {
|
||||
return arr
|
||||
.filter(item => typeof item === 'number' || (typeof item === 'string' && !isNaN(parseFloat(item))))
|
||||
.map(item => (typeof item === 'number' ? item : parseFloat(item)))
|
||||
}
|
||||
|
||||
// 处理y轴最大最小值
|
||||
export const yMethod = (arr: any) => {
|
||||
let numList = dataProcessing(arr)
|
||||
let maxValue = 0
|
||||
let minValue = 0
|
||||
let max = 0
|
||||
let min = 0
|
||||
maxValue = Math.max(...arr)
|
||||
minValue = Math.min(...arr)
|
||||
maxValue = Math.max(...numList)
|
||||
minValue = Math.min(...numList)
|
||||
if (maxValue > 1000 || minValue < -1000) {
|
||||
max = Math.ceil(maxValue / 100) * 100
|
||||
if (minValue == 0) {
|
||||
|
||||
Reference in New Issue
Block a user