Chord diagram
Ribbons between the arcs of a circle. Good for exchanges between places, in both directions.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'chord',
names: ['North', 'South', 'East', 'West', 'Centre'],
matrix: [
[22, 17, 8, 20, 7],
[6, 25, 22, 10, 11],
[10, 10, 38, 3, 26],
[2, 18, 11, 11, 30],
[3, 18, 24, 19, 33],
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type chord takes:
/** `matrix[i][j]`: what goes from the name i to the name j. */
interface ChordSpec extends Base {
type: 'chord';
names: string[];
matrix: number[][];
colors?: string[];
}Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More