echart纵坐标标签特别长换行显示
纵坐标
yAxis : [ { type : 'category', data : name, axisLabel: { //坐标轴刻度标签的相关设置。 textStyle: { color: '#000', fontStyle: 'normal', fontFamily: '微软雅黑', fontSize: 12, }, interval : 0, formatter : function(params){ var newParamsName = ""; var paramsNameNumber = params.length; var provideNumber = 38; var rowNumber = Math.ceil(paramsNameNumber / provideNumber); if (paramsNameNumber > provideNumber) { for (var p = 0; p < rowNumber; p++) { var tempStr = ""; var start = p * provideNumber; var end = start + provideNumber; if (p == rowNumber - 1) { tempStr = params.substring(start, paramsNameNumber); } else { tempStr = params.substring(start, end) + "\n"; } newParamsName += tempStr; } } else { newParamsName = params; } return newParamsName } }, } ]
效果图: