# C waterfall chart 2

> P&L bridge — revenue to net profit with subtotals

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-waterfall-chart-2).

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

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-waterfall-chart-2.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/waterfall-chart`, `@cnippet/chart-card`, `@cnippet/chart-utils`

## Files

### `registry/default/chart-variants/c-waterfall-chart-2.tsx`

```tsx
"use client";

import { ChartCard } from "@/registry/default/charts/chart-card";
import { WaterfallChart } from "@/registry/default/charts/waterfall-chart";
import { formatCurrency } from "@/registry/default/lib/chart-utils";

const data = [
  { amount: 2400000, line: "Revenue" },
  { amount: -960000, line: "COGS" },
  { amount: null, line: "Gross profit" },
  { amount: -540000, line: "Payroll" },
  { amount: -210000, line: "Marketing" },
  { amount: -120000, line: "Tooling" },
  { amount: null, line: "Operating profit" },
  { amount: -142000, line: "Tax" },
  { amount: null, line: "Net profit" },
];

export default function ProfitBridge() {
  return (
    <ChartCard
      className="max-w-2xl"
      description="FY2026 profit and loss, from revenue to net profit"
      title="P&L bridge"
    >
      <WaterfallChart
        category="amount"
        className="h-52"
        config={{ total: { label: "Subtotal" } }}
        data={data}
        index="line"
        indexFormatter={(v) => v.replace(" profit", "")}
        totals={["Revenue", "Gross profit", "Operating profit", "Net profit"]}
        valueFormatter={formatCurrency}
      />
    </ChartCard>
  );
}
```
