修改样式
This commit is contained in:
55
src/utils/echartMethod.ts
Normal file
55
src/utils/echartMethod.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { install$2 } from 'echarts/types/dist/shared'
|
||||
|
||||
export const yMethod = (arr: any) => {
|
||||
console.log('🚀 ~ yMethod ~ arr:', arr)
|
||||
let interval = 0
|
||||
let maxValue = 0
|
||||
let minValue = 0
|
||||
let max = 0
|
||||
let min = 0
|
||||
maxValue = Math.max(...arr)
|
||||
minValue = Math.min(...arr)
|
||||
|
||||
console.log('🚀 ~ yMethod ~ minValue:', minValue)
|
||||
|
||||
// interval = (maxValue - minValue) / 4
|
||||
// if (maxValue > 1000) {
|
||||
// interval = (Math.ceil(maxValue / 100) * 100 - Math.ceil(minValue / 100) * 100) / 4
|
||||
// min = Math.floor((minValue - interval / 2) / 100) * 100
|
||||
// max = Math.ceil((maxValue + interval / 2) / 100) * 100
|
||||
// min >= 0 ? 0 : ''
|
||||
// } else {
|
||||
// min = Math.floor(minValue - interval / 2)
|
||||
// max = Math.ceil(maxValue + interval / 2)
|
||||
// console.log('🚀 ~ yMethod ~ minValue:', minValue)
|
||||
|
||||
// if (minValue >= 0 && minValue < 10) {
|
||||
// min = 0
|
||||
// }
|
||||
// if (maxValue < 1 && maxValue >= 0) {
|
||||
// max = 1
|
||||
// }
|
||||
// interval = (max - min) / 4
|
||||
// }
|
||||
|
||||
// if (interval < 1 && interval > -1) {
|
||||
// interval = 1
|
||||
// }
|
||||
// console.log("🚀 ~ yMethod ~ minValue:", minValue)
|
||||
|
||||
if (maxValue > 1000) {
|
||||
max = Math.ceil(maxValue / 100) * 100
|
||||
min = (Math.floor(minValue / 100) - 1) * 100
|
||||
} else {
|
||||
max = Math.ceil(maxValue / 10) * 10
|
||||
min = Math.floor(minValue / 10) * 10
|
||||
}
|
||||
if (max > 0 && max < 1) {
|
||||
max = 1
|
||||
}
|
||||
// if (min < 0 && min < -1) {
|
||||
// min = -1
|
||||
// }
|
||||
|
||||
return [min, max, interval]
|
||||
}
|
||||
Reference in New Issue
Block a user