现状:
期望:
实现方式:
通过对legend的formatter和textStyle组合设置宽度来实现,代码如下
这里会出现一个问题,发现设置了width没有效果,刚开始以为是宽度给的不够,然后发现并不是,经过多方查找发现一定要设置lineHeight才有效,真真是折磨人,所以正确完整的设置如下图
legend: {
bottom: "0",
show: true,
left: "center",
icon: "circle",
with: "70%",
formatter: ["{a|{name}}"].join("\n"),
textStyle: {
rich: {
a: {
width: 80,
lineHeight: 20,
},
},
},
},