import { PieChart, Pie, Cell, ResponsiveContainer, Legend, Tooltip, } from "recharts"; interface SentimentData { name: string; value: number; color: string; } interface SentimentChartProps { data: SentimentData[]; } export function SentimentChart({ data }: SentimentChartProps) { const total = data.reduce((sum, item) => sum + item.value, 0); const CustomTooltip = ({ active, payload }: any) => { if (active && payload && payload.length) { const item = payload[0].payload; const percentage = ((item.value / total) * 100).toFixed(1); return (
{item.name}
{item.value.toLocaleString()} ulasan ({percentage}%)