Charts
Area Chart
An area chart in plain SVG: the fill conveys volume, but the line stays in charge.
- chart
- area
- svg
- trend
Preview
1440pxHost theme
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/chart-006?lang=en
ПнПтПн
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "chart-006" (Area Chart) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/chart-006.json
Registry item: https://vibeui.ru/r/chart-006.json
Installs to: components/vibeui/chart-006.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
An area chart in plain SVG: the fill conveys volume, but the line stays in charge.
A trend chart: an SVG line with a fill, three grid lines, a dot on the last value and edge axis labels. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Chart006 } from "@/components/vibeui/chart-006"
<Chart006 points={[18, 24, 21, 32]} labels={["Mon", "Tue"]} />
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-chart-006-* palette — do not swap it for your theme tokens
- the line above the fill: an area alone reads as a blob
- vector-effect: non-scaling-stroke — otherwise the stroke stretches with the viewBox
- three grid lines: more turns the chart into graph paper
- role="img" with the value range on the svg
- the dot on the last value — the eye looks for "where are we now"
## 6. You may change
- the points array and the labels
- title and unit
- the accent through the accent prop
- the chart height through the viewBox
## 7. Rules
- Points must be evenly spaced in time: gaps go unnoticed and the grid stays even.
- The fill reaches the bottom of the chart, not the data zero: that is wrong for series with negatives.
- The axis is labelled only at the edges and middle: exact values belong in a table.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/chart-006.jsonhttps://vibeui.ru/r/chart-006.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-chart-006-*. Серверный: хуков нет. Путь линии и площадь считаются из массива точек в системе 300×110, толщина линии не масштабируется благодаря vector-effect. Сетка — три линии; последняя точка помечена кружком. У svg есть role="img" с диапазоном значений.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Chart006Props = Omit<
ComponentPropsWithoutRef<"figure">,
"children" | "title"
> & {
title?: string
points?: number[]
labels?: string[]
unit?: string
accent?: string
}
// Идея компонента: график с заливкой под линией на чистом SVG. Заливка
// подчёркивает объём, но линия остаётся главной: без неё площадь читается как
// клякса. Сетка нарисована тремя линиями — этого хватает, чтобы соотнести
// точку с осью, и не превращает график в тетрадь в клетку.
const STYLES = `
:where([data-vibeui-block="chart-006"]){
--vibeui-chart-006-bg:oklch(1 0 0);
--vibeui-chart-006-fg:oklch(0.22 0.014 265);
--vibeui-chart-006-muted:oklch(0.56 0.014 265);
--vibeui-chart-006-border:oklch(0.91 0.006 265);
--vibeui-chart-006-grid:oklch(0.94 0.004 265);
--vibeui-chart-006-accent:oklch(0.55 0.17 265);
--vibeui-chart-006-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="chart-006"]{
display:flex;flex-direction:column;gap:0.625rem;
width:100%;max-width:24rem;box-sizing:border-box;margin:0;padding:0.875rem;
background:var(--vibeui-chart-006-bg);
border:1px solid var(--vibeui-chart-006-border);border-radius:0.875rem;
color:var(--vibeui-chart-006-fg);font-family:var(--vibeui-chart-006-font);
}
[data-vibeui-block="chart-006"] [data-part="head"]{display:flex;align-items:baseline;justify-content:space-between;gap:0.75rem}
[data-vibeui-block="chart-006"] [data-part="title"]{margin:0;font-size:0.875rem;font-weight:650}
[data-vibeui-block="chart-006"] [data-part="last"]{font-size:0.875rem;font-weight:680;font-variant-numeric:tabular-nums}
[data-vibeui-block="chart-006"] svg{display:block;width:100%;height:auto;overflow:visible}
[data-vibeui-block="chart-006"] [data-part="grid"]{stroke:var(--vibeui-chart-006-grid);stroke-width:1;vector-effect:non-scaling-stroke}
/* Заливка подчёркивает объём, линия остаётся главной. */
[data-vibeui-block="chart-006"] [data-part="area"]{fill:color-mix(in oklab,var(--vibeui-chart-006-accent) 14%,transparent)}
[data-vibeui-block="chart-006"] [data-part="line"]{
fill:none;stroke:var(--vibeui-chart-006-accent);stroke-width:2;
stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke;
}
[data-vibeui-block="chart-006"] [data-part="dot"]{fill:var(--vibeui-chart-006-accent)}
[data-vibeui-block="chart-006"] [data-part="axis"]{
display:flex;justify-content:space-between;gap:0.5rem;
font-size:0.6875rem;color:var(--vibeui-chart-006-muted);
}
[data-vibeui-block="chart-006"] [data-part="unit"]{font-size:0.75rem;color:var(--vibeui-chart-006-muted)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="chart-006"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_POINTS = [18, 24, 21, 32, 29, 41, 38, 52]
const DEFAULT_LABELS = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс", "Пн"]
/**
* График с заливкой под линией на чистом SVG.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Chart006({
title = "Установки компонентов",
points = DEFAULT_POINTS,
labels = DEFAULT_LABELS,
unit = "установок в день",
accent,
className,
style,
...props
}: Chart006Props) {
const width = 300
const height = 110
const max = Math.max(...points, 1)
const min = Math.min(...points, 0)
const span = max - min || 1
const coords = points.map((point, index) => {
const x = (index / Math.max(1, points.length - 1)) * width
const y = height - ((point - min) / span) * (height - 10) - 5
return { x, y }
})
const line = coords
.map((point, index) => `${index === 0 ? "M" : "L"}${point.x} ${point.y}`)
.join(" ")
const area = `${line} L${width} ${height} L0 ${height} Z`
const last = coords[coords.length - 1]
const palette = {
...(accent ? { "--vibeui-chart-006-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-chart-006" precedence="medium">
{STYLES}
</style>
<figure
{...props}
data-vibeui-block="chart-006"
className={className}
style={palette}
>
<div data-part="head">
<figcaption data-part="title">{title}</figcaption>
<span data-part="last">{points[points.length - 1]}</span>
</div>
<svg
viewBox={`0 0 ${width} ${height}`}
preserveAspectRatio="none"
role="img"
aria-label={`${title}: от ${min} до ${max} ${unit}`}
>
{[0.25, 0.5, 0.75].map((step) => (
<line
key={step}
data-part="grid"
x1={0}
x2={width}
y1={height * step}
y2={height * step}
/>
))}
<path data-part="area" d={area} />
<path data-part="line" d={line} />
<circle data-part="dot" cx={last.x} cy={last.y} r={3.5} />
</svg>
<div data-part="axis">
<span>{labels[0]}</span>
<span>{labels[Math.floor(labels.length / 2)]}</span>
<span>{labels[labels.length - 1]}</span>
</div>
<figcaption data-part="unit">{unit}</figcaption>
</figure>
</>
)
}