From 86a5ed382a40c25b41d0c8b21ba5705178dc53e7 Mon Sep 17 00:00:00 2001 From: Lucid Date: Fri, 28 Nov 2025 22:11:56 -0500 Subject: [PATCH] Added reusable line chart. --- src/components/charts/LineChart.tsx | 64 +++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/components/charts/LineChart.tsx diff --git a/src/components/charts/LineChart.tsx b/src/components/charts/LineChart.tsx new file mode 100644 index 0000000..fa4b653 --- /dev/null +++ b/src/components/charts/LineChart.tsx @@ -0,0 +1,64 @@ +import { JSX } from "react"; +import { Chart, useChart } from "@chakra-ui/charts"; +import { + CartesianGrid, + Line, + LineChart, + Tooltip, + XAxis, + YAxis +} from "recharts"; +import { LineChartArr } from "@/types/LineChartStats"; + +interface LineChartComponentProps { + label: "Triggers" | "Links Deleted" | "Commands"; + data: LineChartArr; +} + +const LineChartComponent = ({ + data, + label +}: LineChartComponentProps): JSX.Element => { + const chart = useChart({ + data: [...data], + series: [{ name: label, color: "blue.700" }] + }); + + return ( + + + + + + } + /> + {chart.series.map((item) => ( + + ))} + + + ); +}; + +export default LineChartComponent;