series: [
{
name: '',
type: 'bar',
label: {
show: true,
position: 'top',
// formatter: '失效片'+ '{c}',
formatter: function(v) { //让series 中的文字进行换行
//文字中遇到空格就换行,让value换行可以先把value变成字符串再slice操作
let text = '失效片'+ "\n" + v.value
return text;
}
},
barWidth: 40,
emphasis: {
focus: 'series'
},
data: [320, 332, 301, 334, 390, 330, 320]
},
]
ECharts 顶部 label 换行
最新推荐文章于 2023-12-11 10:43:30 发布