chart-pie-label
yyc3-knowledge-base/chart-pie-labelUnverifiedBlock
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/YYC-Cube/YYC3-Knowledge-Base/main/YYC3-D/ui/apps/v4/chart-pie-label.jsonSource
1"use client"23import { TrendingUp } from "lucide-react"4import { Pie, PieChart } from "recharts"56import {7 Card,8 CardContent,9 CardDescription,10 CardFooter,11 CardHeader,12 CardTitle,13} from "@/registry/new-york/ui/card"14import {15 ChartConfig,16 ChartContainer,17 ChartTooltip,18 ChartTooltipContent,19} from "@/registry/new-york/ui/chart"20const chartData = [21 { browser: "chrome", visitors: 275, fill: "var(--color-chrome)" },22 { browser: "safari", visitors: 200, fill: "var(--color-safari)" },23 { browser: "firefox", visitors: 187, fill: "var(--color-firefox)" },24 { browser: "edge", visitors: 173, fill: "var(--color-edge)" },25 { browser: "other", visitors: 90, fill: "var(--color-other)" },26]2728const chartConfig = {29 visitors: {30 label: "Visitors",31 },32 chrome: {33 label: "Chrome",34 color: "hsl(var(--chart-1))",35 },36 safari: {37 label: "Safari",38 color: "hsl(var(--chart-2))",39 },40 firefox: {41 label: "Firefox",42 color: "hsl(var(--chart-3))",43 },44 edge: {45 label: "Edge",46 color: "hsl(var(--chart-4))",47 },48 other: {49 label: "Other",50 color: "hsl(var(--chart-5))",51 },52} satisfies ChartConfig5354export default function Component() {55 return (56 <Card className="flex flex-col">57 <CardHeader className="items-center pb-0">58 <CardTitle>Pie Chart - Label</CardTitle>59 <CardDescription>January - June 2024</CardDescription>60 </CardHeader>61 <CardContent className="flex-1 pb-0">62 <ChartContainer63 config={chartConfig}64 className="mx-auto aspect-square max-h-[250px] pb-0 [&_.recharts-pie-label-text]:fill-foreground"65 >66 <PieChart>67 <ChartTooltip content={<ChartTooltipContent hideLabel />} />68 <Pie data={chartData} dataKey="visitors" label nameKey="browser" />69 </PieChart>70 </ChartContainer>71 </CardContent>72 <CardFooter className="flex-col gap-2 text-sm">73 <div className="flex items-center gap-2 font-medium leading-none">74 Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />75 </div>76 <div className="leading-none text-muted-foreground">77 Showing total visitors for the last 6 months78 </div>79 </CardFooter>80 </Card>81 )82}
What it pulls in
Other registry items
Files it writes
More from shadcn/ui
All 411 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| chart-area-axeschart-area-axes | shadcn/ui | Blocks | Unverified | no deps | |
| chart-area-defaultchart-area-default | shadcn/ui | Blocks | Unverified | no deps | |
| chart-area-gradientchart-area-gradient | shadcn/ui | Blocks | Unverified | no deps | |
| chart-area-iconschart-area-icons | shadcn/ui | Blocks | Unverified | no deps | |
| chart-area-interactivechart-area-interactive | shadcn/ui | Blocks | Unverified | no deps | |
| chart-area-legendchart-area-legend | shadcn/ui | Blocks | Unverified | no deps | |
| chart-area-linearchart-area-linear | shadcn/ui | Blocks | Unverified | no deps | |
| chart-area-stackedchart-area-stacked | shadcn/ui | Blocks | Unverified | no deps |
