echarts获取y轴刻度区间y轴刻度间隔y轴刻度值

1、直接上图

 

//1.获取y轴刻度区间
let scope = this.spareChart1.getModel().getComponent('yAxis').axis.scale._extent;
//结果:[0, 3500]


//2.获取y轴刻度间隔/轴距
let interval = this.spareChart1.getModel().getComponent('yAxis').axis.scale._interval;
//结果:500
 
//计算出y轴刻度值
let yAxisData = [];
for (let index = 0; index <= (3500/500); index++) {
    yAxisData.push(index*500)
}
 
 
//结果:[0, 500, 1000, 1500, 2000, 2500, 3000, 3500]
posted @ 2021-12-17 23:32  Journey&Flower  阅读(3022)  评论(0)    收藏  举报