echarts柱状图X轴文字超出设置
xAxis: { data: nameArr, axisLine: { show: true, //隐藏X轴轴线 lineStyle: { color: "#01FCE3", }, }, axisTick: { show: false, //隐藏X轴刻度 }, axisLabel: { show: true, textStyle: { color: "#fff", //X轴文字颜色 fontSize: 14, }, // rotate :-30, formatter: function (params) { let newParamsName = ""; const paramsNameNumber = params.length; // 文字总长度 const provideNumber = 2; //一行显示几个字 const rowNumber = Math.ceil(paramsNameNumber / provideNumber); if (paramsNameNumber > provideNumber) { for (let p = 0; p < rowNumber; p++) { const start = p * provideNumber; const end = start + provideNumber; const tempStr = p === rowNumber - 1 ? params.substring(start, paramsNameNumber) : params.substring(start, end) + "\n"; newParamsName += tempStr; } } else { newParamsName = params; } return newParamsName; }, }, },