import { AreaChart, Area, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend, } from "recharts"; import type { DockerStatsJSON } from "./show"; import { format } from "date-fns"; interface Props { acummulativeData: DockerStatsJSON["block"]; } export const DockerBlockChart = ({ acummulativeData }: Props) => { const transformedData = acummulativeData.map((item, index) => { return { time: item.time, name: `Point ${index + 1}`, readMb: item.value.readMb, writeMb: item.value.writeMb, }; }); return (
{`Date: ${format(new Date(payload[0].payload.time), "PPpp")}`}
{`Read ${payload[0].payload.readMb.toFixed(2)} MB`}
{`Write: ${payload[0].payload.writeMb.toFixed(3)} MB`}