# C chart tooltip presets 2

> Stacked total — MRR by plan with a total row

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

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

## Install

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

## Files

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

```tsx
"use client";

import { Bar, BarChart, CartesianGrid, XAxis } from "recharts";
import { ChartTooltipTotal } from "@/registry/default/charts/chart-tooltip-presets";
import {
  buildChartConfig,
  formatCurrency,
} from "@/registry/default/lib/chart-utils";
import { ChartContainer, ChartTooltip } from "@/registry/default/ui/chart";

const data = [
  { enterprise: 14200, month: "Jan", pro: 21800, starter: 6400 },
  { enterprise: 15100, month: "Feb", pro: 23100, starter: 6900 },
  { enterprise: 16800, month: "Mar", pro: 24400, starter: 7300 },
  { enterprise: 17200, month: "Apr", pro: 26900, starter: 7100 },
  { enterprise: 19500, month: "May", pro: 28300, starter: 7800 },
  { enterprise: 21400, month: "Jun", pro: 30200, starter: 8200 },
];

const categories = ["starter", "pro", "enterprise"];
const config = buildChartConfig(categories);

export default function MrrByPlan() {
  return (
    <ChartContainer className="h-64 w-full" config={config}>
      <BarChart accessibilityLayer data={data}>
        <CartesianGrid vertical={false} />
        <XAxis
          axisLine={false}
          dataKey="month"
          tickLine={false}
          tickMargin={8}
        />
        <ChartTooltip
          content={
            <ChartTooltipTotal
              config={config}
              totalLabel="Total MRR"
              valueFormatter={formatCurrency}
            />
          }
          cursor={false}
        />
        {categories.map((key, i) => (
          <Bar
            dataKey={key}
            fill={`var(--color-${key})`}
            key={key}
            radius={i === categories.length - 1 ? [4, 4, 0, 0] : 0}
            stackId="mrr"
          />
        ))}
      </BarChart>
    </ChartContainer>
  );
}
```
