項目中用到echarts柱狀圖,Y軸需要顯示坐標名稱,但是顯示不全,樣式如下:
百度了一下,嘗試了以下方法:
方法一:添加nameLocation屬性,但是效果並非我想要的(PASS)
yAxis: { type: 'value', axisLabel: { textStyle: { color: '#fff' }, }, splitLine: This.splitLine, axisLine: This.axisLine, name: This.yAxisName, nameLocation:"center", // //坐標軸名稱顯示位置。可選:'start','middle','end' },
方法二:修改grid屬性值(我采用的這個方法),通過調整top值達到了想要的效果
grid: { top: '15%', // 組件離容器上側的距離,百分比字符串或整型數字 left: '5%', // 組件離容器左側的距離,百分比字符串或整型數字 right: '5%', bottom: '3%', containLabel: true //grid 區域是否包含坐標軸的刻度標簽, },