import { LineChart, XAxis, YAxis, Line, Tooltip, Legend } from "recharts"; import { timeFormat } from "d3-time-format"; export default function Chart({ data, color, unit }) { const CustomizedTooltip = (props) => { const { active, payload } = props; if (active && payload && payload[0]) { const time = payload[0].payload ? timeFormat("%I:%M")(new Date(payload[0].payload.time), { nearestTo: 1, }) : ""; return (

{time} {payload[0].payload.value} %

); } return null; }; const timeFormatter = (tick) => { return timeFormat("%I:%M")(new Date(tick), { nearestTo: 1, }); }; return ( } /> ); }