import { format } from "date-fns"; import { Area, AreaChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, YAxis, } from "recharts"; import type { DockerStatsJSON } from "./show"; interface Props { acummulativeData: DockerStatsJSON["memory"]; memoryLimitGB: number; } export const DockerMemoryChart = ({ acummulativeData, memoryLimitGB, }: Props) => { const transformedData = acummulativeData.map((item, index) => { return { time: item.time, name: `Point ${index + 1}`, usage: (item.value.used / 1024).toFixed(2), }; }); return (
{`Date: ${format(new Date(payload[0].payload.time), "PPpp")}`}
{`Memory usage: ${payload[0].payload.usage} GB`}