# C pie chart 1

> Browser share — pie with a bottom legend

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/c-pie-chart-1).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/c-pie-chart-1
- Screenshot: https://shadcn.exchange/shot/cnippet/c-pie-chart-1/light.png
- Registry item: https://ui.cnippet.dev/r/c-pie-chart-1.json
- Categories: pie chart
- Listed: 2026-10-27, source last changed 2026-10-27

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-pie-chart-1.json
```

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

## Dependencies

- Registry items: `@cnippet/pie-chart`, `@cnippet/chart-card`, `@cnippet/chart-utils`

## Files

### `registry/default/chart-variants/c-pie-chart-1.tsx`

```tsx
"use client";

import { ChartCard } from "@/registry/default/charts/chart-card";
import { PieChart } from "@/registry/default/charts/pie-chart";
import { formatPercent } from "@/registry/default/lib/chart-utils";

const data = [
  { browser: "Chrome", share: 0.64 },
  { browser: "Safari", share: 0.19 },
  { browser: "Edge", share: 0.08 },
  { browser: "Firefox", share: 0.05 },
  { browser: "Other", share: 0.04 },
];

export default function BrowserShare() {
  return (
    <ChartCard
      className="max-w-sm"
      description="Sessions by browser, October"
      title="Browsers"
    >
      <PieChart
        category="share"
        className="h-60"
        data={data}
        index="browser"
        valueFormatter={(value) => formatPercent(value, { digits: 0 })}
      />
    </ChartCard>
  );
}
```
