關(guān)于highcharts修改y軸名字走過的坎坷路?。?!
因為后臺返回的是數(shù)據(jù)字典,再加上我之前沒用過highcharts所以不知道改個名字竟然這么簡單,還從網(wǎng)上找了一堆的博客都沒有找到方法,下面步入正題
首先找到 yAxis:{}
yAxis: {
title: {
text: "預(yù)期回報(倍)"
},
// 這里修改縱坐標(biāo)顯示的內(nèi)容
labels: {
formatter: function () {
let name = '';
// this_.expectIncomeList這是后臺返回的數(shù)據(jù)字典
this_.expectIncomeList.forEach((a) => {
// 如果左側(cè)數(shù)據(jù)與數(shù)據(jù)字典的value相同則返回name
if (this.value == a.value) {
name = a.name;
}
});
return name;
}
}
},
效果圖
在這里插入圖片描述
在這里插入圖片描述
好啦,每天解決一個小bug~~~~