# C scatter chart 3

> Response time vs payload — single-series correlation

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-scatter-chart-3).

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

## Install

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

## Files

### `registry/default/chart-variants/c-scatter-chart-3.tsx`

```tsx
"use client";

import { ChartCard } from "@/registry/default/charts/chart-card";
import { ScatterChart } from "@/registry/default/charts/scatter-chart";

// Sampled API requests: response time grows with payload size.
const payloads = [
  4, 9, 12, 18, 24, 31, 38, 46, 55, 64, 78, 92, 110, 128, 150, 176, 204, 240,
];
const data = payloads.map((kb, i) => ({
  kb,
  // Fixed jitter so server and client render the same dots.
  ms: Math.round(38 + kb * 1.6 + ((i * 37) % 23) - 11),
}));

export default function ResponseTimeVsPayload() {
  return (
    <ChartCard
      className="max-w-2xl"
      description="Sampled requests to /api/search, last hour"
      title="Response time vs payload"
    >
      <ScatterChart
        className="h-48"
        config={{ ms: { color: "var(--chart-4)", label: "Requests" } }}
        data={data}
        x="kb"
        xLabel="Payload"
        xValueFormatter={(value) => `${value} KB`}
        y="ms"
        yAxisWidth={64}
        yLabel="Response time"
        yValueFormatter={(value) => `${value} ms`}
      />
    </ChartCard>
  );
}
```
