mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 23:29:08 +03:00
68 lines
2.3 KiB
TypeScript
68 lines
2.3 KiB
TypeScript
'use client'
|
|
|
|
import { TrendingUp } from 'lucide-react'
|
|
import { PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart } from 'recharts'
|
|
|
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from 'ui'
|
|
import { ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent } from 'ui'
|
|
|
|
export const description = 'A radar chart with a radius axis'
|
|
|
|
const chartData = [
|
|
{ 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 chartConfig = {
|
|
desktop: {
|
|
label: 'Desktop',
|
|
color: 'hsl(var(--chart-1))',
|
|
},
|
|
mobile: {
|
|
label: 'Mobile',
|
|
color: 'hsl(var(--chart-2))',
|
|
},
|
|
} satisfies ChartConfig
|
|
|
|
export default function Component() {
|
|
return (
|
|
<Card>
|
|
<CardHeader className="items-center pb-4">
|
|
<CardTitle>Radar Chart - Radius Axis</CardTitle>
|
|
<CardDescription>Showing total visitors for the last 6 months</CardDescription>
|
|
</CardHeader>
|
|
<CardContent className="pb-0">
|
|
<ChartContainer config={chartConfig} className="mx-auto aspect-square max-h-[250px]">
|
|
<RadarChart data={chartData}>
|
|
<ChartTooltip
|
|
cursor={false}
|
|
content={<ChartTooltipContent indicator="line" labelKey="month" />}
|
|
/>
|
|
<PolarGrid />
|
|
<Radar dataKey="desktop" fill="var(--color-desktop)" fillOpacity={0.6} />
|
|
<Radar dataKey="mobile" fill="var(--color-mobile)" />
|
|
<PolarRadiusAxis
|
|
angle={60}
|
|
stroke="hsla(var(--foreground))"
|
|
orientation="middle"
|
|
axisLine={false}
|
|
/>
|
|
</RadarChart>
|
|
</ChartContainer>
|
|
</CardContent>
|
|
<CardFooter className="flex-col gap-2 text-sm">
|
|
<div className="flex items-center gap-2 font-medium leading-none">
|
|
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
|
|
</div>
|
|
<div className="flex items-center gap-2 leading-none text-muted-foreground">
|
|
January - June 2024
|
|
</div>
|
|
</CardFooter>
|
|
</Card>
|
|
)
|
|
}
|