A Chord Series visualises movement or change between different items, using nodes and links.
Simple Chord Copy Link
import {
AgChartOptions,
AgCharts,
AnimationModule,
ChordSeriesModule,
ContextMenuModule,
CrosshairModule,
LegendModule,
ModuleRegistry,
} from "ag-charts-enterprise";
ModuleRegistry.registerModules([
AnimationModule,
ChordSeriesModule,
CrosshairModule,
LegendModule,
ContextMenuModule,
]);
const options: AgChartOptions = {
title: {
text: "Global Migrations between Continents",
},
subtitle: {
text: "2023",
},
data: [
{ from: "Asia", to: "Europe", size: 20 },
{ from: "Asia", to: "Americas", size: 19 },
{ from: "Asia", to: "Africa", size: 4 },
{ from: "Asia", to: "Oceania", size: 8 },
{ from: "Europe", to: "Asia", size: 5 },
{ from: "Europe", to: "Americas", size: 5 },
{ from: "Europe", to: "Africa", size: 3 },
{ from: "Europe", to: "Oceania", size: 2 },
{ from: "Americas", to: "Asia", size: 4 },
{ from: "Americas", to: "Europe", size: 5 },
{ from: "Americas", to: "Africa", size: 11 },
{ from: "Americas", to: "Oceania", size: 6 },
{ from: "Africa", to: "Asia", size: 3 },
{ from: "Africa", to: "Europe", size: 9 },
{ from: "Africa", to: "Americas", size: 3 },
{ from: "Oceania", to: "Asia", size: 1 },
{ from: "Oceania", to: "Europe", size: 1 },
{ from: "Oceania", to: "Americas", size: 1 },
],
series: [
{
type: "chord",
fromKey: "from",
toKey: "to",
sizeKey: "size",
sizeName: "Migration (millions)",
},
],
};
options.container = document.getElementById("myChart");
const chart = AgCharts.create(options);
To create a Chord Series, use the chord series type.
{
series: [
{
type: 'chord',
fromKey: 'from',
toKey: 'to',
sizeKey: 'size',
},
],
}In this configuration:
fromKeydefines the start node of each link.toKeydefines the end node of each link.sizeKeydefines the size of each link.
Customisation Copy Link
Node Style Copy Link
import {
AgChartOptions,
AgCharts,
AnimationModule,
ChordSeriesModule,
ContextMenuModule,
CrosshairModule,
LegendModule,
ModuleRegistry,
} from "ag-charts-enterprise";
ModuleRegistry.registerModules([
AnimationModule,
ChordSeriesModule,
CrosshairModule,
LegendModule,
ContextMenuModule,
]);
const options: AgChartOptions = {
title: {
text: "Global Migrations between Continents",
},
subtitle: {
text: "2023",
},
data: [
{ from: "Asia", to: "Europe", size: 20 },
{ from: "Asia", to: "Americas", size: 19 },
{ from: "Asia", to: "Africa", size: 4 },
{ from: "Asia", to: "Oceania", size: 8 },
{ from: "Europe", to: "Asia", size: 5 },
{ from: "Europe", to: "Americas", size: 5 },
{ from: "Europe", to: "Africa", size: 3 },
{ from: "Europe", to: "Oceania", size: 2 },
{ from: "Americas", to: "Asia", size: 4 },
{ from: "Americas", to: "Europe", size: 5 },
{ from: "Americas", to: "Africa", size: 11 },
{ from: "Americas", to: "Oceania", size: 6 },
{ from: "Africa", to: "Asia", size: 3 },
{ from: "Africa", to: "Europe", size: 9 },
{ from: "Africa", to: "Americas", size: 3 },
{ from: "Oceania", to: "Asia", size: 1 },
{ from: "Oceania", to: "Europe", size: 1 },
{ from: "Oceania", to: "Americas", size: 1 },
],
series: [
{
type: "chord",
fromKey: "from",
toKey: "to",
sizeKey: "size",
sizeName: "Migration (millions)",
node: {
fill: "#34495e",
stroke: "#2c3e50",
strokeWidth: 2,
},
},
],
};
options.container = document.getElementById("myChart");
const chart = AgCharts.create(options);
The styling of all nodes can be customised using the node property.
{
series: [
{
type: 'chord',
fromKey: 'from',
toKey: 'to',
sizeKey: 'size',
node: {
fill: '#34495e',
stroke: '#2c3e50',
strokeWidth: 2,
},
},
],
} Link Style Copy Link
import {
AgChartOptions,
AgCharts,
AnimationModule,
ChordSeriesModule,
ContextMenuModule,
CrosshairModule,
LegendModule,
ModuleRegistry,
} from "ag-charts-enterprise";
ModuleRegistry.registerModules([
AnimationModule,
ChordSeriesModule,
CrosshairModule,
LegendModule,
ContextMenuModule,
]);
const options: AgChartOptions = {
title: {
text: "Global Migrations between Continents",
},
subtitle: {
text: "2023",
},
data: [
{ from: "Asia", to: "Europe", size: 20 },
{ from: "Asia", to: "Americas", size: 19 },
{ from: "Asia", to: "Africa", size: 4 },
{ from: "Asia", to: "Oceania", size: 8 },
{ from: "Europe", to: "Asia", size: 5 },
{ from: "Europe", to: "Americas", size: 5 },
{ from: "Europe", to: "Africa", size: 3 },
{ from: "Europe", to: "Oceania", size: 2 },
{ from: "Americas", to: "Asia", size: 4 },
{ from: "Americas", to: "Europe", size: 5 },
{ from: "Americas", to: "Africa", size: 11 },
{ from: "Americas", to: "Oceania", size: 6 },
{ from: "Africa", to: "Asia", size: 3 },
{ from: "Africa", to: "Europe", size: 9 },
{ from: "Africa", to: "Americas", size: 3 },
{ from: "Oceania", to: "Asia", size: 1 },
{ from: "Oceania", to: "Europe", size: 1 },
{ from: "Oceania", to: "Americas", size: 1 },
],
series: [
{
type: "chord",
fromKey: "from",
toKey: "to",
sizeKey: "size",
sizeName: "Migration (millions)",
link: {
fill: "#34495e",
fillOpacity: 0.25,
stroke: "#2c3e50",
strokeWidth: 1,
strokeOpacity: 0.25,
},
},
],
};
options.container = document.getElementById("myChart");
const chart = AgCharts.create(options);
The styling of all links can be customised using the link property.
{
series: [
{
type: 'chord',
fromKey: 'from',
toKey: 'to',
sizeKey: 'size',
link: {
fill: '#34495e',
fillOpacity: 0.25,
stroke: '#2c3e50',
strokeWidth: 1,
strokeOpacity: 0.25,
},
},
],
} Chord Chart Examples Copy Link
See more Chord Chart examples in the AG Charts Gallery.
API Reference Copy Link
Properties available on the AgChordSeriesOptions interface.
- type required
'chord' - Configuration for the Chord Series.
- getItemId
Function - A callback to provide a stable identifier for each node, exposed as `itemId` in events and active state. The returned identifier must be unique across nodes and links, which share one `itemId` namespace (links default to `link-<index>`). If not supplied, the node name is used as its identifier.
- id
stringdefault: auto-generated value - Primary identifier for the series. This is provided as `seriesId` in user callbacks to differentiate multiple series. Auto-generated ids are subject to future change without warning, if your callbacks need to vary behaviour by series please supply your own unique `id` value.
- context
ContextDefault - Context object to use in callbacks.
- data
DatumDefault[] - The data to use when rendering the series. If this is not supplied, data must be set on the chart instead.
- visible
boolean - Whether to display the series.
- cursor
string - The cursor to use for hovered markers. This config is identical to the CSS `cursor` property.
- highlight
AgHighlightOptions - Configuration for highlighting when a series or legend item is hovered over.
- nodeClickRange
InteractionRange - Range from a node that a click triggers the listener.
- showInLegend
boolean - Whether to include the series in the legend.
- listeners
AgSeriesListeners - A map of event names to event listeners.
- fromKey
string - The key containing the start node of each link.
- toKey
string - The key containing the end node of each link.
- sizeKey
string - The key containing the size of each link.
- sizeName
string - A human-readable description of the size values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
- label
AgChordSeriesLabelOptions - Options for the label for each node.
- fills
AgColorType[] - The colours to cycle through for the fills of the nodes and links. An array of colour strings, or fill objects for gradients, patterns, or images.
- strokes
CssColor[] - The colours to cycle through for the strokes of the nodes and links.
- link
AgChordSeriesLinkOptions - Options for the links.
- node
AgChordSeriesNodeOptions - Options for the nodes.
- tooltip
AgSeriesTooltip - Series-specific tooltip configuration.
Properties available on the AgChordSeriesOptions interface.
- type required
'chord' - Configuration for the Chord Series.
- getItemId
Function - A callback to provide a stable identifier for each node, exposed as `itemId` in events and active state. The returned identifier must be unique across nodes and links, which share one `itemId` namespace (links default to `link-<index>`). If not supplied, the node name is used as its identifier.
- id
stringdefault: auto-generated value - Primary identifier for the series. This is provided as `seriesId` in user callbacks to differentiate multiple series. Auto-generated ids are subject to future change without warning, if your callbacks need to vary behaviour by series please supply your own unique `id` value.
- context
ContextDefault - Context object to use in callbacks.
- data
DatumDefault[] - The data to use when rendering the series. If this is not supplied, data must be set on the chart instead.
- visible
boolean - Whether to display the series.
- cursor
string - The cursor to use for hovered markers. This config is identical to the CSS `cursor` property.
- highlight
AgHighlightOptions - Configuration for highlighting when a series or legend item is hovered over.
- nodeClickRange
InteractionRange - Range from a node that a click triggers the listener.
- showInLegend
boolean - Whether to include the series in the legend.
- listeners
AgSeriesListeners - A map of event names to event listeners.
- fromKey
string - The key containing the start node of each link.
- toKey
string - The key containing the end node of each link.
- sizeKey
string - The key containing the size of each link.
- sizeName
string - A human-readable description of the size values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
- label
AgChordSeriesLabelOptions - Options for the label for each node.
- fills
AgColorType[] - The colours to cycle through for the fills of the nodes and links. An array of colour strings, or fill objects for gradients, patterns, or images.
- strokes
CssColor[] - The colours to cycle through for the strokes of the nodes and links.
- link
AgChordSeriesLinkOptions - Options for the links.
- node
AgChordSeriesNodeOptions - Options for the nodes.
- tooltip
AgSeriesTooltip - Series-specific tooltip configuration.