chordData.map(chord => { const { source, target } = chord; const x1 = (innerRadius - 2) * Math.cos((source.endAngle - source.startAngle)/2 + source.startAngle - Math.PI/2); const y1 = (innerRadius - 2) * Math.sin((source.endAngle - source.startAngle)/2 + source.startAngle - Math.PI/2); const x2 = (innerRadius - 2) * Math.cos((target.endAngle - target.startAngle)/2 + target.startAngle - Math.PI/2); const y2 = (innerRadius - 2) * Math.sin((target.endAngle - target.startAngle)/2 + target.startAngle - Math.PI/2); return ( <linearGradient key={this.getGradientId(chord)} id={this.getGradientId(chord)} gradientUnits="userSpaceOnUse" x1={x1} y1={y1} x2={x2} y2={y2} > <stop offset="0%" stopColor={fill(source.index)} /> <stop offset="100%" stopColor={fill(target.index)} /> </linearGradient> ); })