diff --git a/components/PieChart.tsx b/components/PieChart.tsx
index d860115..7df31ee 100644
--- a/components/PieChart.tsx
+++ b/components/PieChart.tsx
@@ -59,9 +59,7 @@ export function PieChart({
{(pie) => (
@@ -73,16 +71,7 @@ export function PieChart({
innerRadius={pieWidth}
outerRadius={width * 0.5}
>
- {(pie) => (
-
- )}
+ {(pie) => }
@@ -90,9 +79,7 @@ export function PieChart({
}
type PieSliceProps = ProvidedProps & {
- isLabel: boolean;
pieTextSize: number;
- labelTextSize: number;
pieTextXOffset: number;
pieTextYOffset: number;
};
@@ -100,9 +87,7 @@ type PieSliceProps = ProvidedProps & {
export function PieSlice({
path,
arcs,
- isLabel,
pieTextSize,
- labelTextSize,
pieTextXOffset,
pieTextYOffset,
}: PieSliceProps) {
@@ -114,18 +99,49 @@ export function PieSlice({
return (
-
+
- {isLabel ? `${arc.data.category}` : `${arc.data.value}%`}
+ {`${arc.data.value}%`}
+
+
+ );
+ })}
+ >
+ );
+}
+
+type PieSliceLabelProps = ProvidedProps & {
+ labelTextSize: number;
+};
+
+export function PieSliceLabel({
+ path,
+ arcs,
+ labelTextSize,
+}: PieSliceLabelProps) {
+ return (
+ <>
+ {arcs.map((arc) => {
+ const [centroidX, centroidY] = path.centroid(arc);
+ const pathArc = path(arc) as string;
+
+ return (
+
+
+
+ {`${arc.data.category}`}
);