# C histogram 1

> Response times — right-skewed latency distribution

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

- Page, with a live preview: https://shadcn.exchange/r/cnippet/c-histogram-1
- Screenshot: https://shadcn.exchange/shot/cnippet/c-histogram-1/light.png
- Registry item: https://ui.cnippet.dev/r/c-histogram-1.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-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/histogram`, `@cnippet/chart-card`

## Files

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

```tsx
"use client";

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

// Deterministic, right-skewed latencies: most fast, a long slow tail.
const latencies = Array.from({ length: 600 }, (_, i) => {
  const u = ((i * 7919) % 600) / 600;
  return Math.round(80 + 40 * Math.sin(i) + 260 * u ** 3);
});

export default function ResponseTimes() {
  return (
    <ChartCard
      className="max-w-2xl"
      description="API response times, last hour (600 requests)"
      footer="Most requests finish under 200 ms; the tail comes from cold caches."
      title="Response time distribution"
    >
      <Histogram
        bins={12}
        className="h-48"
        label="Requests"
        valueFormatter={(v) => `${Math.round(v)} ms`}
        values={latencies}
      />
    </ChartCard>
  );
}
```
