"use client" import * as React from "react" import { Area, AreaChart, Bar, BarChart, CartesianGrid, Label, Line, LineChart, Pie, PieChart, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart, RadialBar, RadialBarChart, XAxis, } from "recharts" import { Example, ExampleWrapper, } from "@/registry/bases/base/components/example" import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/registry/bases/base/ui/card" import { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig, } from "@/registry/bases/base/ui/chart" import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder" const areaChartData = [ { month: "January", desktop: 186 }, { month: "February", desktop: 305 }, { month: "March", desktop: 237 }, { month: "April", desktop: 73 }, { month: "May", desktop: 209 }, { month: "June", desktop: 214 }, ] const areaChartConfig = { desktop: { label: "Desktop", color: "var(--chart-1)", }, } satisfies ChartConfig export default function ChartExample() { return ( ) } function ChartAreaExample() { return ( Area Chart Showing total visitors for the last 6 months value.slice(0, 3)} /> } /> Trending up by 5.2% this month{" "} January - June 2024 ) } const barChartData = [ { month: "January", desktop: 186, mobile: 80 }, { month: "February", desktop: 305, mobile: 200 }, { month: "March", desktop: 237, mobile: 120 }, { month: "April", desktop: 73, mobile: 190 }, { month: "May", desktop: 209, mobile: 130 }, { month: "June", desktop: 214, mobile: 140 }, ] const barChartConfig = { desktop: { label: "Desktop", color: "var(--chart-1)", }, mobile: { label: "Mobile", color: "var(--chart-2)", }, } satisfies ChartConfig function ChartBarExample() { return ( Bar Chart - Multiple January - June 2024 value.slice(0, 3)} /> } /> Trending up by 5.2% this month{" "} Showing total visitors for the last 6 months ) } const lineChartData = [ { month: "January", desktop: 186, mobile: 80 }, { month: "February", desktop: 305, mobile: 200 }, { month: "March", desktop: 237, mobile: 120 }, { month: "April", desktop: 73, mobile: 190 }, { month: "May", desktop: 209, mobile: 130 }, { month: "June", desktop: 214, mobile: 140 }, ] const lineChartConfig = { desktop: { label: "Desktop", color: "var(--chart-1)", }, mobile: { label: "Mobile", color: "var(--chart-2)", }, } satisfies ChartConfig function ChartLineExample() { return ( Line Chart - Multiple January - June 2024 value.slice(0, 3)} /> } /> Trending up by 5.2% this month{" "} Showing total visitors for the last 6 months ) } const pieChartData = [ { browser: "chrome", visitors: 275, fill: "var(--color-chrome)" }, { browser: "safari", visitors: 200, fill: "var(--color-safari)" }, { browser: "firefox", visitors: 287, fill: "var(--color-firefox)" }, { browser: "edge", visitors: 173, fill: "var(--color-edge)" }, { browser: "other", visitors: 190, fill: "var(--color-other)" }, ] const pieChartConfig = { visitors: { label: "Visitors", }, chrome: { label: "Chrome", color: "var(--chart-1)", }, safari: { label: "Safari", color: "var(--chart-2)", }, firefox: { label: "Firefox", color: "var(--chart-3)", }, edge: { label: "Edge", color: "var(--chart-4)", }, other: { label: "Other", color: "var(--chart-5)", }, } satisfies ChartConfig function ChartPieExample() { const totalVisitors = React.useMemo(() => { return pieChartData.reduce((acc, curr) => acc + curr.visitors, 0) }, []) return ( Pie Chart - Donut with Text January - June 2024 } /> { if (viewBox && "cx" in viewBox && "cy" in viewBox) { return ( {totalVisitors.toLocaleString()} Visitors ) } }} /> Trending up by 5.2% this month{" "} Showing total visitors for the last 6 months ) } const radarChartData = [ { month: "January", desktop: 186, mobile: 80 }, { month: "February", desktop: 305, mobile: 200 }, { month: "March", desktop: 237, mobile: 120 }, { month: "April", desktop: 73, mobile: 190 }, { month: "May", desktop: 209, mobile: 130 }, { month: "June", desktop: 214, mobile: 140 }, ] const radarChartConfig = { desktop: { label: "Desktop", color: "var(--chart-1)", }, mobile: { label: "Mobile", color: "var(--chart-2)", }, } satisfies ChartConfig function ChartRadarExample() { return ( Radar Chart - Multiple Showing total visitors for the last 6 months } /> Trending up by 5.2% this month{" "} January - June 2024 ) } const radialChartData = [ { browser: "safari", visitors: 1260, fill: "var(--color-safari)" }, ] const radialChartConfig = { visitors: { label: "Visitors", }, safari: { label: "Safari", color: "var(--chart-2)", }, } satisfies ChartConfig function ChartRadialExample() { return ( Radial Chart - Shape January - June 2024 { if (viewBox && "cx" in viewBox && "cy" in viewBox) { return ( {radialChartData[0].visitors.toLocaleString()} Visitors ) } }} /> Trending up by 5.2% this month{" "} Showing total visitors for the last 6 months ) }