eCharts圖表中Y軸的分段數太多,顯示起來不太好看,需要減少分段的數量,一開始設定interval屬性,一直不生效,代碼如下:
yAxis : [
{
type : 'value',
axisTick: { // 坐标軸小标記
show:false
},
splitLine: {show:false},
axisLabel: {
interval:1,
show: true,
textStyle: {
color: '#666'
}
}
}
],
後來通過閱讀相關文檔發現y軸會預設劃分為5個分段,是以通過設定了splitNumber屬性實作了想要的功能,代碼如下:
yAxis : [
{
type : 'value',
axisTick: { // 坐标軸小标記
show:false
},
splitLine: {show:false},
splitNumber:3,
axisLabel: {
show: true,
textStyle: {
color: '#666'
}
}
}
],
附相關的文檔位址:
https://www.w3cschool.cn/echarts_tutorial/echarts_tutorial-pj1y2cuo.html