Skip to content
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
Weekly plays before and after the new release day
ShowFriday releaseMonday releaseChange
Morning Brief42k51k+9k
Deep Dive36k33k−3k
Weekend Chat29k18k−11k
Tech Corner21k31k+10k
Local News14k15k+1k
  • data is a list of items. Each item has a label, a start value, an end value, and an optional color.
  • 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.
  • format sets the text of a value, and height sets the height in pixels (default 300).
  • For screen readers, the chart is a table with the change of each item. label names the table. Name the columns with labels or a label pack: start (default "Before"), end (default "After"), item, and change.

Usage ​

ts
import { BlessSlopeChart } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
data*BlessSlopeItem[]—
heightnumber300
format((v: number) => string)—
labelstring"Chart"names the chart and its table for screen readers
labelsPartial<{ start: string; end: string; item: string; change: string; }>—

Released under the MIT License. Character names and artwork belong to their owners.