You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.0 KiB
TypeScript
56 lines
1.0 KiB
TypeScript
"use client";
|
|
|
|
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts";
|
|
|
|
import {
|
|
ChartConfig,
|
|
ChartContainer,
|
|
ChartTooltip,
|
|
ChartTooltipContent,
|
|
} from "@/components/ui/chart";
|
|
|
|
const chartConfig = {
|
|
value: {
|
|
label: "Count",
|
|
color: "hsl(var(--chart-1))",
|
|
},
|
|
foldtime: {
|
|
label: "Fold Time",
|
|
color: "hsl(var(--chart-2))",
|
|
},
|
|
} satisfies ChartConfig;
|
|
|
|
export function DayChart({
|
|
chartData,
|
|
}: {
|
|
chartData: {
|
|
day: string;
|
|
value: number;
|
|
foldtime: number;
|
|
}[];
|
|
}) {
|
|
return (
|
|
<ChartContainer config={chartConfig}>
|
|
<BarChart accessibilityLayer data={chartData}>
|
|
<CartesianGrid vertical={false} />
|
|
<XAxis
|
|
dataKey="day"
|
|
tickLine={false}
|
|
tickMargin={10}
|
|
axisLine={false}
|
|
/>
|
|
<ChartTooltip
|
|
cursor={false}
|
|
content={<ChartTooltipContent indicator="line" />}
|
|
/>
|
|
<Bar dataKey="value" fill="var(--color-value)" radius={4} />
|
|
<Bar
|
|
dataKey="foldtime"
|
|
fill="var(--color-foldtime)"
|
|
radius={4}
|
|
/>
|
|
</BarChart>
|
|
</ChartContainer>
|
|
);
|
|
}
|