feat: add LabelList to pie chart to display category names

This commit is contained in:
Yoga Pangestu 2026-04-23 13:32:20 +07:00
parent cb11ee9be6
commit c1c87da623

View File

@ -1,7 +1,7 @@
"use client" "use client"
import React, { useMemo } from "react" import React, { useMemo } from "react"
import { Pie, PieChart } from "recharts" import { LabelList, Pie, PieChart } from "recharts"
import { import {
Card, Card,
@ -71,7 +71,14 @@ export const CustomPieChart = React.memo(function CustomPieChart({
dataKey="total" dataKey="total"
nameKey="name" nameKey="name"
label label
/> >
<LabelList
dataKey="name"
className="fill-background font-medium"
stroke="none"
fontSize={12}
/>
</Pie>
</PieChart> </PieChart>
</ChartContainer> </ChartContainer>
</CardContent> </CardContent>