import { DateTime } from "luxon"; import { LineChart, Line, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine, ReferenceDot, Label, } from "recharts"; import "./Graph.css"; const Graph = (props) => { const { name, response, dataKey } = props; const { data, loading, error } = response; if (loading) { return
; } const eventStyle = { fill: "#767676" }; const parsed = data.map((d) => { return { date: DateTime.fromSQL(d["last_updated"], { zone: "UTC" }).setZone(DateTime.local().zoneName).toSeconds(), value: d[dataKey], }; }); const latest = parsed[parsed.length - 1]; const prior = parsed[parsed.length - 2]; const toTheMoon = latest.value > prior.value + 1; return ({DateTime.fromSeconds(label).toLocaleString({ weekday: "long", month: "long", day: "2-digit", })}
{payload[0].value}