"use client" import { Area, AreaChart, CartesianGrid, XAxis } from "recharts" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card" import { ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, } from "@/components/ui/chart" export interface ChartDataPoint { month: Date models: number datasets: number spaces: number } interface AreaChartStackedProps { data: ChartDataPoint[] } const chartConfig = { models: { label: "Models", color: "hsl(var(--chart-1))", }, datasets: { label: "Datasets", color: "hsl(var(--chart-2))", }, spaces: { label: "Spaces", color: "hsl(var(--chart-3))", }, } satisfies ChartConfig export function AreaChartStacked({ data }: AreaChartStackedProps) { const sortedData = [...data].sort( (a, b) => a.month.getTime() - b.month.getTime() ) return ( Hugging Face Hub Growth Each Month Monthly creation trends for models, datasets, and spaces {data.length > 0 ? ( { const date = new Date(value) return date.toLocaleString("default", { month: "short", year: "numeric", }) }} /> } /> } /> ) : (
Loading...
)}
) }