# C brush chart 2

> Sensor log — three days of 10-minute readings

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-brush-chart-2).

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

## Install

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

## Files

### `registry/default/chart-variants/c-brush-chart-2.tsx`

```tsx
"use client";

import { BrushChart } from "@/registry/default/charts/brush-chart";
import { ChartCard } from "@/registry/default/charts/chart-card";

// Readings every 10 minutes for three days: daily cycle plus a door-left-open dip.
const data = Array.from({ length: 432 }, (_, i) => {
  const minutes = i * 10;
  const day = Math.floor(minutes / 1440) + 23;
  const hh = String(Math.floor((minutes % 1440) / 60)).padStart(2, "0");
  const mm = String(minutes % 60).padStart(2, "0");
  const dip = i > 250 && i < 262 ? -3.5 : 0;
  return {
    humidity: Math.round(46 + 6 * Math.cos((minutes / 1440) * 2 * Math.PI)),
    temperature:
      Math.round(
        (21.5 + 2.2 * Math.sin((minutes / 1440) * 2 * Math.PI - 2) + dip) * 10,
      ) / 10,
    time: `Oct ${day} ${hh}:${mm}`,
  };
});

export default function SensorLog() {
  return (
    <ChartCard
      className="max-w-2xl"
      description="Server room sensor, every 10 minutes"
      title="Temperature"
    >
      <BrushChart
        categories={["temperature"]}
        chartType="line"
        className="h-60"
        config={{
          temperature: { color: "var(--chart-5)", label: "Temperature" },
        }}
        data={data}
        index="time"
        valueFormatter={(value) => `${value} °C`}
        yAxisWidth={56}
      />
    </ChartCard>
  );
}
```
