# C synced charts 3

> Traffic vs conversion — sessions and rate by hour

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

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

## Files

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

```tsx
"use client";

import { SyncedCharts } from "@/registry/default/charts/synced-charts";
import { formatPercent } from "@/registry/default/lib/chart-utils";

// Traffic vs conversion by hour: the evening peak brings visitors, not buyers.
const data = Array.from({ length: 24 }, (_, h) => ({
  conversion:
    Math.round(
      (0.031 + 0.009 * Math.sin(((h - 9) / 24) * 2 * Math.PI)) * 1000,
    ) / 1000,
  hour: `${String(h).padStart(2, "0")}:00`,
  sessions: Math.round(
    900 +
      2600 * Math.max(0, Math.sin(((h - 6) / 24) * 2 * Math.PI)) +
      (h >= 19 && h <= 22 ? 1400 : 0),
  ),
}));

export default function TrafficAndConversion() {
  return (
    <div className="w-full max-w-2xl rounded-lg border bg-card p-5">
      <div className="mb-3 font-medium text-sm">Today by hour</div>
      <SyncedCharts
        data={data}
        index="hour"
        panelClassName="h-28"
        panels={[
          { categories: ["sessions"], title: "Sessions" },
          {
            categories: ["conversion"],
            config: {
              conversion: { color: "var(--chart-2)", label: "Conversion" },
            },
            title: "Conversion rate",
            type: "line",
            valueFormatter: (value) => formatPercent(value),
          },
        ]}
      />
    </div>
  );
}
```
