Files
zellyy-finance/src/components/ExpenseChart.tsx
gpt-engineer-app[bot] 30c76a2e1a Adjust card width on desktop
The card width was too wide on desktop. Adjusted the width to be slightly smaller than the four icon area at the bottom.
2025-03-16 06:16:55 +00:00

42 lines
992 B
TypeScript

import React from 'react';
import { PieChart, Pie, Cell, ResponsiveContainer } from 'recharts';
interface ExpenseData {
name: string;
value: number;
color: string;
}
interface ExpenseChartProps {
data: ExpenseData[];
}
const ExpenseChart: React.FC<ExpenseChartProps> = ({ data }) => {
return (
<div className="neuro-card h-64 desktop-card">
<ResponsiveContainer width="100%" height="100%">
<PieChart>
<Pie
data={data}
cx="50%"
cy="50%"
innerRadius={50}
outerRadius={70}
paddingAngle={5}
dataKey="value"
labelLine={false}
label={({ name, percent }) => `${name} ${(percent * 100).toFixed(0)}%`}
>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={entry.color} />
))}
</Pie>
</PieChart>
</ResponsiveContainer>
</div>
);
};
export default ExpenseChart;