legend: {
top: 'center',
left: '55%',
orient: 'vertical',
// itemGap: 20,
itemWidth: 9,
itemHeight: 9,
icon: 'circle',
itemStyle: {
borderType: 'dotted'
},
width: '30%',
textStyle: {
color: '#D1DEE2',
fontSize: 12,
},
formatter: function (name) {
const currentItem = cusOption.data.filter(item => {
if (name === item.name) {return item}
})
let item = currentItem[0]
return `${echarts.format.truncateText(item.name, isMaxWidth ? 320 : 220, '14px Microsoft Yahei', '…')} ${item.value}` ;
}
Echarts legend 文本过长显示省略号解决方案
于 2023-10-27 15:01:16 首次发布