# C histogram 2

> Order values — two clusters of basket sizes

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-histogram-2).

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

## Install

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

## Files

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

```tsx
"use client";

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

// Deterministic order values clustered around $45 and $120.
const orders = Array.from({ length: 400 }, (_, i) => {
  const wobble = ((i * 37) % 41) - 20;
  return i % 3 === 0 ? 120 + wobble * 1.8 : 45 + wobble;
});

export default function OrderValues() {
  return (
    <ChartCard
      className="max-w-2xl"
      description="Value of 400 orders placed in October"
      title="Order value"
      value={`${formatCurrency(66.4, "USD", { compact: false })} avg`}
    >
      <Histogram
        bins={10}
        className="h-48"
        color="var(--chart-2)"
        label="Orders"
        valueFormatter={(v) => `$${Math.round(v)}`}
        values={orders}
      />
    </ChartCard>
  );
}
```
