# Pie Chart Half

> A semicircular gauge-style pie showing battery share by device, with a caption under the arc.

A shadcn/ui block from the [@esuiss](https://suiss.app/ui?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/esuiss/pie-chart-half).

- Page, with a live preview: https://shadcn.exchange/r/esuiss/pie-chart-half
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/esuiss/pie-chart-half-light-0d880af0417c4bdc.png
- Registry item: https://suiss.app/ui/r/new-york-v4/pie-chart-half.json
- Categories: charts, charts-pie
- Listed: 2026-10-20, source last changed 2026-10-20

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/esuiss/pie-chart-half.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `recharts`
- Registry items: `@esuiss/card`, `@esuiss/chart`

## Files

### `components/charts/pie-chart-half.tsx`

```tsx
"use client"

import { Pie, PieChart } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
} from "@/components/ui/chart"

const chartData = [
  { device: "phone", share: 40, fill: "var(--color-phone)" },
  { device: "laptop", share: 25, fill: "var(--color-laptop)" },
  { device: "tablet", share: 20, fill: "var(--color-tablet)" },
  { device: "watch", share: 15, fill: "var(--color-watch)" },
]

const chartConfig = {
  share: { label: "Share" },
  phone: { label: "Phone", color: "var(--chart-1)" },
  laptop: { label: "Laptop", color: "var(--chart-2)" },
  tablet: { label: "Tablet", color: "var(--chart-3)" },
  watch: { label: "Watch", color: "var(--chart-4)" },
} satisfies ChartConfig

export function PieChartHalf() {
  return (
    <Card variant="filled" size="sm">
      <CardHeader>
        <CardTitle>Half circle</CardTitle>
        <CardDescription>Battery use by device · last 24 hours</CardDescription>
      </CardHeader>
      <CardContent>
        <div className="relative">
          <ChartContainer
            config={chartConfig}
            className="aspect-auto h-44 w-full"
          >
            <PieChart accessibilityLayer>
              <ChartTooltip
                cursor={false}
                content={
                  <ChartTooltipContent
                    hideLabel
                    nameKey="device"
                    formatter={(value, name) => (
                      <span>
                        {chartConfig[name as keyof typeof chartConfig].label} ·{" "}
                        <span className="font-semibold tabular-nums">
                          {value}%
                        </span>
                      </span>
                    )}
                  />
                }
              />
              <Pie
                data={chartData}
                dataKey="share"
                nameKey="device"
                cy="88%"
                startAngle={180}
                endAngle={0}
                innerRadius="105%"
                outerRadius="150%"
                paddingAngle={1.5}
                cornerRadius={4}
                stroke="none"
              />
            </PieChart>
          </ChartContainer>
          <div className="pointer-events-none absolute inset-x-0 bottom-[12%] flex flex-col items-center text-center">
            <span className="text-2xl font-semibold tracking-tight tabular-nums">
              100%
            </span>
            <span className="text-xs text-muted-foreground">last 24 hours</span>
          </div>
        </div>
      </CardContent>
    </Card>
  )
}
```
