我们在项目中,遇到echarts纵坐标自适应最大值与实际最大值相差太多,导致纵坐标太高

echarts时间轴纵坐标最大值最小值设置

 

 

 这个时候我们可以设置他的纵坐标的最大值

yAxis:{
 max: function(value) {
,value.max)
  //正常情况下已经可以拿到最大值了,下面的处理是为了使得最大值是整十整百的数字,使得坐标轴美观。
= Math.pow(10, n -1) // 10, 100, 1000,..... 这里是为了拿到
let floorNUm = Math.floor(value.max / pow) //1,2,3,4,5,.....,这里是为了拿到max的最高位数字 let max = (floorNUm + 1) * pow console.log("max", max ? max : 200) return max ? max : 200; }
min: function(value) {
  .....//同理拿到最小值再做一系列适合的处理
}
}

 

相关文章:

  • 2021-08-16
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-04-20
  • 2021-07-24
猜你喜欢
  • 2022-01-18
  • 2022-01-25
  • 2022-12-23
  • 2021-05-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
相关资源
相似解决方案