处理前
处理后
axisLabel配置
axisLabel: {
interval: 0,
formatter: function (value) {
return spliceStr(value, 4)
},
textStyle: {
fontFamily: 'Microsoft YaHei',
color: 'rgba(170, 185, 208, 1)',
fontSize: 12
}
},
截取方法 只截取中文
var spliceStr = function (value, len) {
if (value.length <= len) {
return value
}
var newValue = "";
var k = 0;
for (var i = Math.ceil(value.length / len); i > 0; i--) {
newValue += value.substr(k, len) + (i == 1? '':'\n');
k += len;
}
return newValue;
}