Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(arc => {
const angle = absoluteAngleRadians(midAngle(arc) - Math.PI / 2)
const positionA = positionFromAngle(angle, radius + linkOffset)
const positionB = positionFromAngle(angle, radius + linkOffset + linkDiagonalLength)
let positionC
let labelPosition
let textAlign
if (
absoluteAngleDegrees(radiansToDegrees(angle)) < 90 ||
absoluteAngleDegrees(radiansToDegrees(angle)) >= 270
) {
positionC = { x: positionB.x + linkHorizontalLength, y: positionB.y }
labelPosition = {
x: positionB.x + linkHorizontalLength + textXOffset,
y: positionB.y,
}
const getRibbonAngles = ({ source, target }, useMiddleAngle, springConfig) => {
let firstArc
let secondArc
if (source.startAngle < target.startAngle) {
firstArc = source
secondArc = target
} else {
firstArc = target
secondArc = source
}
let angles
if (useMiddleAngle === true) {
const firstMiddleAngle = midAngle(firstArc)
const secondMiddleAngle = midAngle(secondArc)
angles = {
sourceStartAngle: firstMiddleAngle,
sourceEndAngle: firstMiddleAngle,
targetStartAngle: secondMiddleAngle,
targetEndAngle: secondMiddleAngle,
}
} else {
angles = {
sourceStartAngle: firstArc.startAngle,
sourceEndAngle: firstArc.endAngle,
targetStartAngle: secondArc.startAngle,
targetEndAngle: secondArc.endAngle,
}
}
const getRibbonAngles = ({ source, target }, useMiddleAngle, springConfig) => {
let firstArc
let secondArc
if (source.startAngle < target.startAngle) {
firstArc = source
secondArc = target
} else {
firstArc = target
secondArc = source
}
let angles
if (useMiddleAngle === true) {
const firstMiddleAngle = midAngle(firstArc)
const secondMiddleAngle = midAngle(secondArc)
angles = {
sourceStartAngle: firstMiddleAngle,
sourceEndAngle: firstMiddleAngle,
targetStartAngle: secondMiddleAngle,
targetEndAngle: secondMiddleAngle,
}
} else {
angles = {
sourceStartAngle: firstArc.startAngle,
sourceEndAngle: firstArc.endAngle,
targetStartAngle: secondArc.startAngle,
targetEndAngle: secondArc.endAngle,
}
}
.map(arc => {
const angle = midAngle(arc) - Math.PI / 2
const position = positionFromAngle(angle, centerRadius)
return (
arcs.forEach(arc => {
const angle = midAngle(arc)
const props = getPolarLabelProps(radius + labelOffset, angle, labelRotation)
ctx.save()
ctx.translate(props.x, props.y)
ctx.rotate(degreesToRadians(props.rotate))
ctx.textAlign = props.align
ctx.textBaseline = props.baseline
ctx.fillStyle = getLabelTextColor(arc, theme)
ctx.fillText(arc.label, 0, 0)
ctx.restore()
})
styles={arcs.map(arc => {
const angle = midAngle(arc)
return {
key: arc.id,
data: arc,
style: {
angle: spring(angle, springConfig),
},
}
})}
>
{arcs.map(arc => {
const color = getColor(arc, theme)
const angle = midAngle(arc)
const textProps = getPolarLabelProps(radius, angle, rotation)
return (
{arcs.filter(arc => skipAngle === 0 || arc.angleDeg > skipAngle).map(arc => {
const angle = midAngle(arc) - Math.PI / 2
const position = positionFromAngle(angle, centerRadius)
return (