chart-pie-stacked
yyc3-knowledge-base/chart-pie-stackedUnverifiedBlock
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-stacked.jsonSource
1"use client"23import * as React from "react"4import { TrendingUp } from "lucide-react"5import { Label, Pie, PieChart } from "recharts"67import {8 Card,9 CardContent,10 CardDescription,11 CardFooter,12 CardHeader,13 CardTitle,14} from "@/registry/new-york/ui/card"15import {16 ChartConfig,17 ChartContainer,18 ChartTooltip,19 ChartTooltipContent,20} from "@/registry/new-york/ui/chart"21const desktopData = [22 { month: "january", desktop: 186, fill: "var(--color-january)" },23 { month: "february", desktop: 305, fill: "var(--color-february)" },24 { month: "march", desktop: 237, fill: "var(--color-march)" },25 { month: "april", desktop: 173, fill: "var(--color-april)" },26 { month: "may", desktop: 209, fill: "var(--color-may)" },27]2829const mobileData = [30 { month: "january", mobile: 80, fill: "var(--color-january)" },31 { month: "february", mobile: 200, fill: "var(--color-february)" },32 { month: "march", mobile: 120, fill: "var(--color-march)" },33 { month: "april", mobile: 190, fill: "var(--color-april)" },34 { month: "may", mobile: 130, fill: "var(--color-may)" },35]3637const chartConfig = {38 visitors: {39 label: "Visitors",40 },41 desktop: {42 label: "Desktop",43 },44 mobile: {45 label: "Mobile",46 },47 january: {48 label: "January",49 color: "hsl(var(--chart-1))",50 },51 february: {52 label: "February",53 color: "hsl(var(--chart-2))",54 },55 march: {56 label: "March",57 color: "hsl(var(--chart-3))",58 },59 april: {60 label: "April",61 color: "hsl(var(--chart-4))",62 },63 may: {64 label: "May",65 color: "hsl(var(--chart-5))",66 },67} satisfies ChartConfig6869export default function Component() {70 return (71 <Card className="flex flex-col">72 <CardHeader className="items-center pb-0">73 <CardTitle>Pie Chart - Stacked</CardTitle>74 <CardDescription>January - June 2024</CardDescription>75 </CardHeader>76 <CardContent className="flex-1 pb-0">77 <ChartContainer78 config={chartConfig}79 className="mx-auto aspect-square max-h-[250px]"80 >81 <PieChart>82 <ChartTooltip83 content={84 <ChartTooltipContent85 labelKey="visitors"86 nameKey="month"87 indicator="line"88 labelFormatter={(_, payload) => {89 return chartConfig[90 payload?.[0].dataKey as keyof typeof chartConfig91 ].label92 }}93 />94 }95// … truncated
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 |
