可以的啊,改成下满的语句,记得用html显示,不然不会换行
function sumLabel(){ const point = this; const points = point.points; const validPoints = points.filter( (point) => point.isVisible() ); if(point == validPoints[validPoints.length - 2]) //把汇总值显示在第2个系列 { let value = 0; for(let i = 0; i < validPoints.length-1; i++) //求和的值包含的系列为从下往上数前2个系列 { value += validPoints[i].value; } return value +"\n"+this.value; } else { return this.value; }}
效果