# C time range chart 2

> Revenue — 3m / 6m / 12m monthly bars

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

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

## Install

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

## Files

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

```tsx
"use client";

import { ChartCard } from "@/registry/default/charts/chart-card";
import { TimeRangeChart } from "@/registry/default/charts/time-range-chart";
import { formatCurrency } from "@/registry/default/lib/chart-utils";

const months = [
  "Nov",
  "Dec",
  "Jan",
  "Feb",
  "Mar",
  "Apr",
  "May",
  "Jun",
  "Jul",
  "Aug",
  "Sep",
  "Oct",
];
const revenue = [
  38200, 44100, 36900, 38400, 41700, 43900, 47200, 46100, 50800, 53400, 55900,
  58700,
];
const data = months.map((month, i) => ({ month, revenue: revenue[i] ?? 0 }));

export default function RevenueByMonths() {
  return (
    <ChartCard className="max-w-2xl" title="Revenue">
      <TimeRangeChart
        categories={["revenue"]}
        chartType="bar"
        className="h-40"
        data={data}
        defaultRange="12m"
        index="month"
        ranges={[
          { label: "3m", size: 3 },
          { label: "6m", size: 6 },
          { label: "12m" },
        ]}
        valueFormatter={formatCurrency}
      />
    </ChartCard>
  );
}
```
