export const yMethod = (arr: any) => { let maxValue = 0 let minValue = 0 let max = 0 let min = 0 maxValue = Math.max(...arr) minValue = Math.min(...arr) if (maxValue > 1000 ||minValue < -1000) { max = Math.ceil(maxValue / 100) * 100 if (minValue == 0) { min = 0 } else { min = (Math.floor(minValue / 100) ) * 100 } } else { max = Math.ceil(maxValue / 10) * 10 min = Math.floor(minValue / 10) * 10 } if (maxValue > 0 && maxValue < 1) { max = 1 } else if (max == 0 && minValue > -1 && minValue < 0) { min = -1 } return [min, max] }