Set the X-axis text of the echarts histogram to display redundant ellipsis

Renderings:

 

xAxis:[
    {
       //文字
                axisLabel: {
                    color: '#4c9bfd',
                	rotate:20,
                	fontSize:10,
                	showMaxLabel: true,
          			interval: 0,  // 强制让所有的字段展示
	                formatter: function (value) {
		              if (value !== undefined) {
		                  if (value.length > 4) {      // 超出5个字符显示省略号
		                     return `${value.slice(0, 5)}...`;
		                  }
		                  return value;
		                }
		            },
//              	fontWeight:'bold',
                },
    }

]

Guess you like

Origin blog.csdn.net/qq_17211063/article/details/130866770