使用nameTruncate即可解决
option = {
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {},
xAxis: [
{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}
],
yAxis: [
{
type: 'value',
nameTextStyle: {
overflow: 'truncate',
width: 10 // 无法实现坐标轴名称溢出指定宽度隐藏
},
nameTruncate: { maxWidth: 60 }, // 官方回复
name: '喜羊羊与灰太狼'
}
],
series: [
{
name: '直接访问',
type: 'bar',
barWidth: '60%',
data: [10, 52, 200, 334, 390, 330, 220]
}
]
};