"use client"; import { useQuery } from "@tanstack/react-query"; import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer, CartesianGrid, ScatterChart, Scatter, Legend, Cell, PieChart, Pie, } from "recharts"; import { api } from "@/lib/api"; import { useT } from "@/i18n/context"; import { Card, CardContent } from "@/components/ui/card"; const TOOLTIP = { contentStyle: { background: "var(--popover)", border: "1px solid var(--border)", borderRadius: 8, fontSize: 12, color: "var(--popover-foreground)", }, cursor: { fill: "var(--muted)", opacity: 0.3 }, }; export function EdaCharts() { const { dict } = useT(); const { data, isLoading } = useQuery({ queryKey: ["eda"], queryFn: api.eda }); if (isLoading || !data) { return ( {dict.common.loading} ); } return (
{data.sex_dist.map((_, i) => ( ))} d.HeartDisease === 0)} fill="var(--success)" name={dict.common.low} /> d.HeartDisease === 1)} fill="var(--destructive)" name={dict.common.high} />
); } function ChartCard({ title, children, }: { title: string; children: React.ReactNode; }) { return (

{title}

{children}
); }