feat: improve balance calculations in statistics page and charts with enhanced formatting for large values

This commit is contained in:
Julien Froidefond
2025-11-30 12:19:34 +01:00
parent 184a073bb1
commit ebf842cf6d
3 changed files with 87 additions and 17 deletions

View File

@@ -37,9 +37,21 @@ export function MonthlyChart({ data, formatCurrency }: MonthlyChartProps) {
<BarChart data={data}>
<CartesianGrid strokeDasharray="3 3" className="stroke-muted" />
<XAxis dataKey="month" className="text-xs" />
<YAxis className="text-xs" tickFormatter={(v) => `${v}`} />
<YAxis
className="text-xs"
width={80}
tickFormatter={(v) => {
// Format compact pour les grandes valeurs
if (Math.abs(v) >= 1000) {
return `${(v / 1000).toFixed(1)}k€`;
}
return `${Math.round(v)}`;
}}
tick={{ fill: "var(--muted-foreground)" }}
/>
<Tooltip
formatter={(value: number) => formatCurrency(value)}
labelFormatter={(label) => label}
contentStyle={{
backgroundColor: "var(--card)",
border: "1px solid var(--border)",