Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.ctx.fillStyle = arc.color
this.ctx.strokeStyle = getBorderColor({ ...arc.data, color: arc.color })
this.ctx.lineWidth = borderWidth
arcGenerator(arc)
this.ctx.fill()
if (borderWidth > 0) this.ctx.stroke()
})
if (enableSlicesLabels === true) {
const { sliceLabel, slicesLabelsSkipAngle, slicesLabelsTextColor } = props
drawSliceLabels(this.ctx, arcs, {
arcGenerator,
skipAngle: slicesLabelsSkipAngle,
getLabel: getLabelGenerator(sliceLabel),
getTextColor: getInheritedColorGenerator(slicesLabelsTextColor, theme),
theme,
})
}
if (enableRadialLabels === true) {
const {
radialLabel,
radialLabelsSkipAngle,
radialLabelsLinkOffset,
radialLabelsLinkStrokeWidth,
radialLabelsLinkDiagonalLength,
radialLabelsLinkHorizontalLength,
radialLabelsTextXOffset,
radialLabelsTextColor,
radialLabelsLinkColor,
} = props
withPropsOnChange(['ribbonBorderColor', 'theme'], ({ ribbonBorderColor, theme }) => ({
getRibbonBorderColor: getInheritedColorGenerator(ribbonBorderColor, theme),
})),
pure
withPropsOnChange(['labelTextColor', 'theme'], ({ labelTextColor, theme }) => ({
getLabelTextColor: getInheritedColorGenerator(labelTextColor, theme),
})),
withPropsOnChange(
withPropsOnChange(['childColor', 'theme'], ({ childColor, theme }) => ({
getChildColor: getInheritedColorGenerator(childColor, theme),
})),
withPropsOnChange(
/>
))}
{enableRadialLabels && (
)}
{enableSlicesLabels && (
withPropsOnChange(['nodeBorderColor', 'theme'], ({ nodeBorderColor, theme }) => ({
getNodeBorderColor: getInheritedColorGenerator(nodeBorderColor, theme),
})),
withPropsOnChange(['labelTextColor', 'theme'], ({ labelTextColor, theme }) => ({
radialLabelsTextXOffset,
radialLabelsTextColor,
radialLabelsLinkColor,
} = props
drawRadialLabels(this.ctx, arcs, {
radius,
getLabel: getLabelGenerator(radialLabel),
skipAngle: radialLabelsSkipAngle,
linkOffset: radialLabelsLinkOffset,
linkDiagonalLength: radialLabelsLinkDiagonalLength,
linkHorizontalLength: radialLabelsLinkHorizontalLength,
linkStrokeWidth: radialLabelsLinkStrokeWidth,
textXOffset: radialLabelsTextXOffset,
getTextColor: getInheritedColorGenerator(radialLabelsTextColor, theme),
getLinkColor: getInheritedColorGenerator(radialLabelsLinkColor, theme),
theme,
})
}
this.ctx.restore()
legends.forEach(legend => {
renderLegendToCanvas(this.ctx, {
...legend,
data: arcs.map(arc => ({
id: arc.data.id,
label: arc.data.id,
color: arc.color,
})),
containerWidth: width,
containerHeight: height,
this.surface.width = outerWidth * pixelRatio
this.surface.height = outerHeight * pixelRatio
this.ctx.scale(pixelRatio, pixelRatio)
this.ctx.fillStyle = theme.background
this.ctx.fillRect(0, 0, outerWidth, outerHeight)
this.ctx.save()
this.ctx.translate(margin.left, margin.top)
arcGenerator.context(this.ctx)
this.ctx.save()
this.ctx.translate(centerX, centerY)
const getBorderColor = getInheritedColorGenerator(borderColor, theme)
arcs.forEach(arc => {
this.ctx.beginPath()
this.ctx.fillStyle = arc.color
this.ctx.strokeStyle = getBorderColor({ ...arc.data, color: arc.color })
this.ctx.lineWidth = borderWidth
arcGenerator(arc)
this.ctx.fill()
if (borderWidth > 0) this.ctx.stroke()
})
if (enableSlicesLabels === true) {
const { sliceLabel, slicesLabelsSkipAngle, slicesLabelsTextColor } = props
drawSliceLabels(this.ctx, arcs, {
arcGenerator,
withPropsOnChange(['cellBorderColor', 'theme'], ({ cellBorderColor, theme }) => ({
getCellBorderColor: getInheritedColorGenerator(cellBorderColor, theme),
})),
withPropsOnChange(['labelTextColor', 'theme'], ({ labelTextColor, theme }) => ({