Calm motion: animations on this site only fade, with no movement
Slope chart
Two columns, such as before and after, with a line for each item
Shows which items went up and which went down between two moments. The angle of a line shows the change. For the gap of each item on one row, use the dumbbell.
Basic
| Show | Friday release | Monday release | Change |
|---|---|---|---|
| Morning Brief | 42k | 51k | +9k |
| Deep Dive | 36k | 33k | −3k |
| Weekend Chat | 29k | 18k | −11k |
| Tech Corner | 21k | 31k | +10k |
| Local News | 14k | 15k | +1k |
datais a list of items. Each item has alabel, astartvalue, anendvalue, and an optionalcolor.- A rise has a solid line in the chart color. A fall has a dashed gray line, so the direction does not rest on the color alone.
- The name and the start value sit to the left, and the end value to the right. A hover on a line makes the others faint.
formatsets the text of a value, andheightsets the height in pixels (default 300).- For screen readers, the chart is a table with the change of each item.
labelnames the table. Name the columns withlabelsor a label pack:start(default "Before"),end(default "After"),item, andchange.
Usage
ts
import { BlessSlopeChart } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
data* | BlessSlopeItem[] | — | |
height | number | 300 | |
format | ((v: number) => string) | — | |
label | string | "Chart" | names the chart and its table for screen readers |
labels | Partial<{ start: string; end: string; item: string; change: string; }> | — |