/* ======================================== File: frontend/features/map/components/area-chart.tsx ======================================== */ "use client"; import { LineChart, Line, ResponsiveContainer, XAxis, YAxis, Tooltip } from "@/components/ui/chart"; // Using shared ui chart components import { useTheme } from "next-themes"; interface AreaChartProps { data: number[]; color: string; } export function AreaChart({ data, color }: AreaChartProps) { const { theme } = useTheme(); const isDark = theme === "dark"; // Generate labels (e.g., months or simple indices) const labels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"]; // Example labels // Format the data for the chart const chartData = data.map((value, index) => ({ name: labels[index % labels.length] || `Point ${index + 1}`, // Use labels or fallback value: value, })); // Format the price for display in tooltip const formatPrice = (value: number) => { return new Intl.NumberFormat("th-TH", { style: "currency", currency: "THB", minimumFractionDigits: 0, maximumFractionDigits: 0, }).format(value); }; return (