# V chart 10

> Basic chart

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-chart-10).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-chart-10
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-chart-10-light-99dea42b248423d7.png
- Registry item: https://ui.cnippet.dev/r/v-chart-10.json
- Categories: chart
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-chart-10.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/chart`

## Files

### `registry/default/variants/v-chart-10.tsx`

```tsx
"use client";

import {
  Bar,
  BarChart,
  CartesianGrid,
  ReferenceLine,
  XAxis,
  YAxis,
} from "recharts";
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
} from "@/registry/default/ui/chart";

const TARGET = 50000;

const chartData = [
  { month: "Jan", revenue: 38000 },
  { month: "Feb", revenue: 44000 },
  { month: "Mar", revenue: 52000 },
  { month: "Apr", revenue: 47000 },
  { month: "May", revenue: 61000 },
  { month: "Jun", revenue: 58000 },
];

const chartConfig = {
  revenue: { color: "var(--chart-1)", label: "Revenue" },
} satisfies ChartConfig;

export function Pattern() {
  return (
    <ChartContainer className="min-h-52 w-full" config={chartConfig}>
      <BarChart
        accessibilityLayer
        data={chartData}
        margin={{ left: 8, right: 48 }}
      >
        <CartesianGrid vertical={false} />
        <XAxis
          axisLine={false}
          dataKey="month"
          tickLine={false}
          tickMargin={8}
        />
        <YAxis
          axisLine={false}
          tickFormatter={(v) => `$${(v / 1000).toFixed(0)}k`}
          tickLine={false}
          width={40}
        />
        <ChartTooltip
          content={
            <ChartTooltipContent
              formatter={(v) => `$${Number(v).toLocaleString()}`}
              hideLabel
            />
          }
          cursor={false}
        />
        <ReferenceLine
          label={{
            fill: "hsl(var(--muted-foreground))",
            fontSize: 11,
            position: "right",
            value: "Target",
          }}
          stroke="hsl(var(--destructive))"
          strokeDasharray="4 4"
          y={TARGET}
        />
        <Bar dataKey="revenue" fill="var(--color-revenue)" radius={4} />
      </BarChart>
    </ChartContainer>
  );
}
```
