mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
- Enable all 15 finance component docs (from .disabled → .mdx) - Create stock-market.mdx, 8 chart docs, 8 block docs, 2 framework docs - Add direction.tsx component (RTL/LTR support from upstream shadcn) - Add xs/icon-xs button sizes, data-variant/data-size attributes - Fix build-registry.mts to handle default exports in namespace re-exports - Add default props to order-entry, positions-list, orders-history, trading-panel - Fix 18 navigation stubs → re-export from root implementations - Add 44 orphaned MDX files to nav (installation, dark-mode, desktop, guides, etc) - Migrate 6 framer-motion imports → motion/react - Bump React 19.2.0→19.2.4, Next.js 16.0.1→16.1.6, motion→12.34.0 - Align lucide-react, sonner v2, tailwind-merge v3, postcss-selector-parser v7 - Remove framer-motion dep (superseded by motion) - Fix @types/react-dom, TypeScript versions across workspaces
53 lines
1.2 KiB
Plaintext
53 lines
1.2 KiB
Plaintext
---
|
|
title: Pie Chart
|
|
description: Pie and donut charts for showing proportional data and distributions.
|
|
---
|
|
|
|
## Overview
|
|
|
|
Pie charts display data as proportional slices of a circle, ideal for showing parts of a whole.
|
|
|
|
## Usage
|
|
|
|
```tsx
|
|
import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@hanzo/ui"
|
|
import { Pie, PieChart } from "recharts"
|
|
|
|
const data = [
|
|
{ browser: "Chrome", visitors: 275, fill: "var(--color-chrome)" },
|
|
{ browser: "Safari", visitors: 200, fill: "var(--color-safari)" },
|
|
{ browser: "Firefox", visitors: 187, fill: "var(--color-firefox)" },
|
|
]
|
|
|
|
const config = {
|
|
chrome: { label: "Chrome", color: "hsl(var(--chart-1))" },
|
|
safari: { label: "Safari", color: "hsl(var(--chart-2))" },
|
|
firefox: { label: "Firefox", color: "hsl(var(--chart-3))" },
|
|
}
|
|
|
|
export function PieChartDemo() {
|
|
return (
|
|
<ChartContainer config={config}>
|
|
<PieChart>
|
|
<ChartTooltip content={<ChartTooltipContent />} />
|
|
<Pie data={data} dataKey="visitors" nameKey="browser" />
|
|
</PieChart>
|
|
</ChartContainer>
|
|
)
|
|
}
|
|
```
|
|
|
|
## Variants
|
|
|
|
### Donut Chart
|
|
|
|
Use `innerRadius` and `outerRadius` to create donut charts.
|
|
|
|
### With Labels
|
|
|
|
Add labels inside or outside slices.
|
|
|
|
### Interactive
|
|
|
|
Highlight slices on hover with `activeIndex`.
|