Line chart
A pixel step line over time. Hover or the arrows read a point; the values are a table too.
import { LineChart } from "@forgeron/ui";Left and right arrows read one point.
| Point | Value |
|---|---|
| W35 | 12 |
| W36 | 14 |
| W37 | 13 |
| W38 | 17 |
| W39 | 16 |
| W40 | 21 |
| W41 | 19 |
| W42 | 24 |
| W43 | 26 |
| W44 | 25 |
| W45 | 29 |
| W46 | 33 |
import { LineChart } from "@forgeron/ui";
const weeks = [12, 14, 13, 17, 16, 21, 19, 24, 26, 25, 29, 33];
export default function Default() {
return (
<div style={{ width: 320 }}>
<LineChart
title="Signups"
height={96}
points={weeks.map((value, i) => ({ label: `W${35 + i}`, value }))}
/>
</div>
);
}Left and right arrows read one point.
| Point | Value | Before |
|---|---|---|
| Oct 21 | 420 | 380 |
| Oct 22 | 455 | 400 |
| Oct 23 | 610 | 520 |
| Oct 24 | 640 | 560 |
| Oct 25 | 590 | 540 |
| Oct 26 | 300 | 280 |
| Oct 27 | 260 | 240 |
| Oct 28 | 480 | 430 |
| Oct 29 | 530 | 470 |
| Oct 30 | 660 | 580 |
| Oct 31 | 700 | 610 |
| Nov 1 | 690 | 600 |
| Nov 2 | 340 | 300 |
| Nov 3 | 310 | 280 |
| Nov 4 | 510 | 450 |
| Nov 5 | 560 | 500 |
| Nov 6 | 720 | 630 |
| Nov 7 | 760 | 660 |
| Nov 8 | 740 | 650 |
| Nov 9 | 380 | 330 |
| Nov 10 | 330 | 300 |
| Nov 11 | 540 | 480 |
| Nov 12 | 600 | 520 |
| Nov 13 | 780 | 680 |
| Nov 14 | 810 | 700 |
| Nov 15 | 790 | 690 |
| Nov 16 | 410 | 350 |
| Nov 17 | 360 | 320 |
import { LineChart } from "@forgeron/ui";
const days = [
420, 455, 610, 640, 590, 300, 260, 480, 530, 660, 700, 690, 340, 310, 510, 560, 720, 760, 740,
380, 330, 540, 600, 780, 810, 790, 410, 360,
];
const before = [
380, 400, 520, 560, 540, 280, 240, 430, 470, 580, 610, 600, 300, 280, 450, 500, 630, 660, 650,
330, 300, 480, 520, 680, 700, 690, 350, 320,
];
// Four weeks from Oct 21: the dotted line is the four weeks before.
const date = (i: number) => (i < 11 ? `Oct ${21 + i}` : `Nov ${i - 10}`);
export default function AgainstLastPeriod() {
return (
<div style={{ width: "100%" }}>
<LineChart
title="Requests per day"
points={days.map((value, i) => ({ label: date(i), value }))}
previous={before}
format={(v) => v.toLocaleString("en")}
/>
</div>
);
}Left and right arrows read one point.
| Point | Value |
|---|---|
| Jan | €21.4k |
| Feb | €23.8k |
| Mar | €22.1k |
| Apr | €27.6k |
| May | €29.9k |
| Jun | €31.2k |
| Jul | €24.8k |
| Aug | €22.3k |
| Sep | €33.9k |
| Oct | €41.7k |
| Nov | €48.2k |
import { LineChart } from "@forgeron/ui";
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov"];
const revenue = [21400, 23800, 22100, 27600, 29900, 31200, 24800, 22300, 33900, 41700, 48210];
const euros = (v: number) => `€${(v / 1000).toFixed(1)}k`;
export default function Money() {
return (
<div style={{ width: "100%", maxWidth: 480 }}>
<LineChart
title="Revenue, 2026"
height={120}
format={euros}
points={months.map((label, i) => ({ label, value: revenue[i]! }))}
/>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | — | Names the chart; also its caption. |
points | { label, value }[] | — | In order, oldest first. |
previous | number[] | — | The same points one period earlier, dotted in grey behind the line. |
format | (value: number) => string | String | Writes a value. |
height | number | 160 | Of the plot, in px. |
className | string | — | Extra classes. |