# C realtime chart 1

> Requests per second — live stream

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

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

## Install

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

## Files

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

```tsx
"use client";

import { ChartCard } from "@/registry/default/charts/chart-card";
import { RealtimeChart } from "@/registry/default/charts/realtime-chart";

// Stand-in for a websocket: requests per second with noise and the odd burst.
function nextRps() {
  const base = 420 + 60 * Math.sin(Date.now() / 8000);
  const burst = Math.random() < 0.08 ? 180 : 0;
  return { rps: Math.round(base + (Math.random() - 0.5) * 70 + burst) };
}

export default function LiveRequests() {
  return (
    <ChartCard className="max-w-2xl" title="Requests per second">
      <RealtimeChart
        categories={["rps"]}
        className="h-48"
        config={{ rps: { color: "var(--chart-1)", label: "req/s" } }}
        onTick={nextRps}
        windowSize={40}
      />
    </ChartCard>
  );
}
```
