# C synced charts 1

> Server metrics — CPU, memory and network

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

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

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-synced-charts-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/synced-charts`

## Files

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

```tsx
"use client";

import { SyncedCharts } from "@/registry/default/charts/synced-charts";

// One host, last 60 minutes: a batch job at :35 spikes CPU, memory and network together.
const data = Array.from({ length: 60 }, (_, i) => {
  const job = i >= 35 && i < 44 ? 1 : 0;
  return {
    cpu: Math.round(28 + 6 * Math.sin(i / 4) + job * 48),
    memory: Math.round((5.2 + 0.02 * i + job * 2.1) * 10) / 10,
    network: Math.round(12 + 4 * Math.cos(i / 5) + job * 36),
    time: `14:${String(i).padStart(2, "0")}`,
  };
});

export default function ServerMetrics() {
  return (
    <div className="w-full max-w-2xl rounded-lg border bg-card p-5">
      <div className="mb-3 font-medium text-sm">web-2 · last hour</div>
      <SyncedCharts
        data={data}
        index="time"
        panelClassName="h-20"
        panels={[
          {
            categories: ["cpu"],
            config: { cpu: { color: "var(--chart-1)", label: "CPU" } },
            title: "CPU",
            valueFormatter: (value) => `${value}%`,
          },
          {
            categories: ["memory"],
            config: { memory: { color: "var(--chart-2)", label: "Memory" } },
            title: "Memory",
            type: "line",
            valueFormatter: (value) => `${value} GB`,
          },
          {
            categories: ["network"],
            config: { network: { color: "var(--chart-5)", label: "Network" } },
            title: "Network",
            valueFormatter: (value) => `${value} MB/s`,
          },
        ]}
      />
    </div>
  );
}
```
