Calm motion: animations on this site only fade, with no movement
Chord diagram
Groups around a circle, with ribbons for the flows between them
Shows flows in both directions between a few groups, for example the listeners who move from one show to another. For flows in one direction through steps, use the Sankey chart.
Basic
| From | To Morning Brief | To Deep Dive | To Weekend Chat | To Tech Corner |
|---|---|---|---|---|
| Morning Brief | 0 | 4200 | 1800 | 2500 |
| Deep Dive | 3000 | 0 | 1200 | 2000 |
| Weekend Chat | 1500 | 900 | 0 | 600 |
| Tech Corner | 2800 | 2200 | 400 | 0 |
groupsis a list of groups, each with akey, alabel, and an optionalcolor.matrixis a square grid in the order of the groups.matrix[i][j]is the flow from group i to group j.- The arc of a group follows the sum of its row. Each ribbon joins two groups. Its width at each end is the flow out of that end, and its color is the color of the bigger flow.
- A hover on a ribbon makes the others faint and shows the flows both ways.
sizesets the width of the chart (default 320), andformatsets the text of a value. - Keep to about eight groups, so that the labels and the ribbons stay easy to read.
- For screen readers, the chart is a table of the full matrix.
labelnames the table. Change the words withlabelsor a label pack:from, andto(a function of the name).
Usage
ts
import { BlessChordDiagram } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
groups* | BlessChordGroup[] | — | |
matrix* | number[][] | — | `matrix[i][j]` is the flow from group i to group j |
size | number | 320 | the width of the chart in pixels |
format | ((v: number) => string) | — | |
label | string | "Chart" | names the chart and its table for screen readers |
labels | Partial<{ from: string; to: (name: string) => string; }> | — |