echarts realizes dual Y-axis scale alignment

Without further ado, let’s go straight to the code:

min: min2,
max: max2,
splitNumber: 5,
interval: (max2 - min2) / 5,
const min1 = this._getMinValue(dataArr1),
										min2 = this._getMinValue(dataArr2),
										max1 = this._getMaxValue(dataArr1),
										max2 = this._getMaxValue(dataArr2);
	        _getMinValue(arr) {
				const min = Math.min(...arr);
				// 这样处理是为了不让最大值刚好到坐标轴最底部
				return Math.floor(min / 12) * 10;
			},
			_getMaxValue(arr) {
				const max = Math.max(...arr);
				// 这样处理是为了不让最大值刚好到坐标轴最顶部
				return Math.ceil(max / 9.5) * 10;
			},

Finally, the dual y-axis scale alignment is perfectly realized, 666

Guess you like

Origin blog.csdn.net/qq_37299479/article/details/133993436
Recommended