Add y-offset

pull/19/head
Jared He 9 months ago
parent 52f346d3ce
commit 165c1d1061
  1. 6
      components/PieChart.tsx
  2. 4
      data/mocks.ts

@ -74,11 +74,11 @@ export function PieSlices({ isLabel, ...props }: PieSlicesProps<PieChartData>) {
/>
<text
className={isLabel ? styles.labelText : styles.pieText}
x={centroidX}
y={centroidY}
x={isLabel ? centroidX : centroidX}
y={isLabel ? centroidY : centroidY + 10}
textAnchor="middle"
>
{isLabel ? `${arc.data.category}` : `${arc.data.value}%`}
{isLabel ? `${arc.data.category}` : `${arc.data.value}%`}
</text>
</g>
);

@ -43,10 +43,10 @@ export const mockPieData = [
},
{
category: "Quail",
value: 38,
value: 48,
},
{
category: "Cuckoo",
value: 20,
value: 10,
},
];

Loading…
Cancel
Save