# C brush chart 1

> Two years of revenue — starts zoomed to 90 days

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-brush-chart-1).

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

## Install

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

## Files

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

```tsx
"use client";

import { BrushChart } from "@/registry/default/charts/brush-chart";
import { ChartCard } from "@/registry/default/charts/chart-card";
import { formatCurrency, formatDate } from "@/registry/default/lib/chart-utils";

// Two years of daily revenue with growth, seasonality and a weekly rhythm.
const data = Array.from({ length: 730 }, (_, i) => {
  const date = new Date(Date.UTC(2024, 9, 26 + i));
  return {
    date: date.toISOString().slice(0, 10),
    revenue: Math.round(
      1800 +
        2.4 * i +
        420 * Math.sin((i / 365) * 2 * Math.PI - 1.2) +
        160 * Math.sin((i / 7) * 2 * Math.PI),
    ),
  };
});

export default function TwoYearsOfRevenue() {
  return (
    <ChartCard
      className="max-w-2xl"
      description="Drag the handles below to zoom; starts on the last 90 days"
      title="Daily revenue"
    >
      <BrushChart
        categories={["revenue"]}
        className="h-60"
        data={data}
        defaultWindow={90}
        index="date"
        indexFormatter={(value) => formatDate(value)}
        valueFormatter={formatCurrency}
      />
    </ChartCard>
  );
}
```
