import { ResponsiveContainer, AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip as RechartsTooltip } from "recharts"; import { format } from "date-fns"; import type { ParsedReading } from "@/hooks/use-readings"; interface TelemetryChartProps { data: ParsedReading[]; dataKey: "ph" | "turbidity" | "temperature" | "hardness"; color: string; title: string; unit: string; } export function TelemetryChart({ data, dataKey, color, title, unit }: TelemetryChartProps) { const gradientId = `color-${dataKey}`; return (

{title}

{unit}
{data.length === 0 ? (
AWAITING TELEMETRY DATA...
) : ( format(new Date(t), "HH:mm")} stroke="#4b5563" tick={{ fontSize: 11, fill: "#6b7280", fontFamily: "monospace" }} tickMargin={12} minTickGap={30} /> format(new Date(l), "MMM d, yyyy HH:mm:ss")} formatter={(value: number) => [`${value.toFixed(2)} ${unit}`, title]} /> )}
); }