Calm motion: animations on this site only fade, with no movement
Streamgraph
Stacked areas around a center line
Shows how a mix changes over time, for example the plays of each topic month by month. The streams sit on top of each other around a center line, so the thickness of the whole is the total. To read exact values over time, use the line chart.
Basic
| Month | News | Tech | Culture | Sport |
|---|---|---|---|---|
| Jan | 42k | 18k | 25k | 12k |
| Feb | 40k | 22k | 24k | 15k |
| Mar | 37k | 29k | 27k | 21k |
| Apr | 35k | 34k | 31k | 26k |
| May | 33k | 38k | 30k | 33k |
| Jun | 36k | 41k | 28k | 38k |
| Jul | 39k | 40k | 26k | 30k |
| Aug | 44k | 37k | 29k | 22k |
datais a list of steps in order.xnames the field of a row with the text of its step, such asmonth.seriestakes the same series as the bar and the line charts. Each series has akey, an optionallabel, and an optionalcolor. The first series is the bottom stream.- Values below zero count as zero. The legend above the chart names the streams in the same order.
- If the chart is narrow, the labels under it skip some steps.
formatsets the text of a value in the table, andheightsets the height in pixels (default 260). - For screen readers, the chart is a table with a row for each step.
labelnames the table. Change the name of the first column withlabelsor a label pack:step.
Usage
ts
import { BlessStreamgraph } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
data* | BlessChartRow[] | — | one row for each step on the x axis, in order |
x* | string | — | the field of a row with the text of its step, for example the month |
series* | BlessChartSeries[] | — | one stream for each series; the first is the bottom one |
height | number | 260 | |
format | ((v: number) => string) | — | text for one value, for example `(v) => v + "k"` |
label | string | "Chart" | names the chart and its table for screen readers |
labels | Partial<{ step: string; }> | — |