核心代码
childOption.legend.formatter = (name) => { const itemValueArr = ChildSeruesData.filter(el => el.variable == name) const itemValueAll = ChildSeruesData.reduce((total, num) => { return total + Math.round(num.value); }, 0) return `${name}(${(itemValueArr[0].value / itemValueAll * 100).toFixed(2)}%)` }
效果