Circular layout for visualizing relationships or network flows. Modification of d3-chord to enable display of multiple categories of chords in the same chart.

d3, d3-module, chord, radial, network, flow, multichord
npm install d3-multichord@0.0.2



This is a modification of d3-chord to enable another dimension of data to be shown between nodes.

Circular layout for visualizing relationships or network flows with multiple types.


If you use NPM, npm install d3-multichord. Otherwise, download the latest release.

API Reference

This module is an adaptation of d3-chord. Only the changes relevant to the multichord version are included here.

# d3.multichord() <>

Constructs a new multichord layout with the default settings.

# chord(matrix) <>

Computes the chord layout for the specified three-dimensional matrix of shape n×n×m, where the matrix represents the directed flow amongst a network (a complete digraph) of n nodes, and links between nodes are classified into m categories. The given matrix must be an array of length n, where each element matrix[i] is an array of n numbers, where each matrix[i][j] represents the flow from the ith node in the network to the jth node, and each element matrix[i][j][k] is a an array of length m that represents the value of the flow from each of m categories. Each number within matrix[i][j][k] must be nonnegative, though it can be zero if there is no flow from node i to node j for that category.

Sample data from the US Census Migration Data by Nativity Example:

var matrix = [

The chords array also defines a secondary array of length n, chords.groups, where each group represents the combined inflow and outflow for node i, corresponding to the sum of the elements in matrix[i][0 … n - 1][0 … m - 1], and is an object with the following properties:

  • startAngle - the start angle in radians
  • endAngle - the end angle in radians
  • value - in: the total incoming flow value for node i; out: the total outgoing flow value for node i
  • index - the node index i