---
title: "Chord Series"
framework: javascript
version: "14.1.0"
---

# Chord Series

A Chord Series visualises movement or change between different items, using nodes and links.

## Simple Chord

#### Chord Diagram

```ts
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);
```

[Live example: Chord Diagram](https://www.ag-grid.com/charts/typescript/chord-series/examples/simple-chord)

To create a Chord Series, use the `chord` series type.

```js
{
    series: [
        {
            type: 'chord',
            fromKey: 'from',
            toKey: 'to',
            sizeKey: 'size',
        },
    ],
}
```

In this configuration:

- `fromKey` defines the start node of each link.
- `toKey` defines the end node of each link.
- `sizeKey` defines the size of each link.

## Customisation

### Node Style

#### Node Style

```ts
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);
```

[Live example: Node Style](https://www.ag-grid.com/charts/typescript/chord-series/examples/node-style)

The styling of all nodes can be customised using the `node` property.

```js
{
    series: [
        {
            type: 'chord',
            fromKey: 'from',
            toKey: 'to',
            sizeKey: 'size',
            node: {
                fill: '#34495e',
                stroke: '#2c3e50',
                strokeWidth: 2,
            },
        },
    ],
}
```

### Link Style

#### Link Style

```ts
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);
```

[Live example: Link Style](https://www.ag-grid.com/charts/typescript/chord-series/examples/link-style)

The styling of all links can be customised using the `link` property.

```js
{
    series: [
        {
            type: 'chord',
            fromKey: 'from',
            toKey: 'to',
            sizeKey: 'size',
            link: {
                fill: '#34495e',
                fillOpacity: 0.25,
                stroke: '#2c3e50',
                strokeWidth: 1,
                strokeOpacity: 0.25,
            },
        },
    ],
}
```

## API Reference

#### Chord Series

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| 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 | string | 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. |
| highlight.enabled | boolean |  | Set to `false` to disable highlighting. |
| highlight.highlightedItem | AgHighlightStyleOptions |  | Options for the highlighted item. |
| highlight.highlightedItem.opacity | Opacity |  | The opacity of the whole series (line, fill, labels and markers, if any) |
| highlight.highlightedItem.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| highlight.highlightedItem.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| highlight.highlightedItem.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| highlight.highlightedItem.lineDash | PixelSize[] |  | An array specifying the length in pixels of alternating dashes and gaps. |
| highlight.highlightedItem.lineDashOffset | PixelSize |  | The initial offset of the dashed line in pixels. |
| highlight.highlightedItem.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| highlight.highlightedItem.fillOpacity | Opacity |  | The opacity of the fill colour. |
| highlight.unhighlightedItem | AgHighlightStyleOptions |  | Options for the un-highlighted items when there is an active highlight. |
| highlight.unhighlightedItem.opacity | Opacity |  | The opacity of the whole series (line, fill, labels and markers, if any) |
| highlight.unhighlightedItem.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| highlight.unhighlightedItem.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| highlight.unhighlightedItem.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| highlight.unhighlightedItem.lineDash | PixelSize[] |  | An array specifying the length in pixels of alternating dashes and gaps. |
| highlight.unhighlightedItem.lineDashOffset | PixelSize |  | The initial offset of the dashed line in pixels. |
| highlight.unhighlightedItem.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| highlight.unhighlightedItem.fillOpacity | Opacity |  | The opacity of the fill colour. |
| nodeClickRange | PixelSize \| 'exact' \| 'nearest' \| 'area' |  | 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. |
| listeners.seriesNodeClick | Listener |  | The listener to call when a node (marker, column, bar, tile or a pie sector) in the series is clicked. |
| listeners.seriesNodeDoubleClick | Listener |  | The listener to call when a node (marker, column, bar, tile or a pie sector) in the series is double-clicked. |
| 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. |
| label.spacing | PixelSize |  | Spacing between a node and its label. |
| label.maxWidth | PixelSize |  | If the label text exceeds the maximum length, it will be truncated and an ellipsis will be appended to indicate this. |
| label.formatter | RichFormatter |  | A custom formatting function used to convert data values into text for display by labels. |
| label.format | string |  | Format string used when rendering labels. |
| label.itemStyler | Styler |  | Function used to style individual datum labels. |
| label.enabled | boolean |  | Whether the associated elements and properties should be used in the chart. |
| label.color | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for text elements. A colour string, or a theme-colour reference object. |
| label.fontSize | FontSize |  | The size of the font in pixels for text elements. |
| label.fontFamily | FontFamily |  | The font family for text elements. |
| label.fontStyle | FontStyle |  | The style to use for text elements. |
| label.fontWeight | FontWeight |  | The font weight to use for text elements. |
| label.border | BorderOptions |  | Stroke options for the box border. |
| label.border.enabled | boolean |  | Whether the associated elements and properties should be used in the chart. |
| label.border.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| label.border.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| label.border.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| label.cornerRadius | PixelSize |  | Apply rounded corners to the label box. |
| label.padding | PixelSize \| PaddingOptions |  | Distance between the label text and the border. A number applies uniform padding; an object sets each side. |
| label.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| label.fillOpacity | Opacity |  | The opacity of the fill colour. |
| fills | Array<CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill> |  | 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. |
| link.itemStyler | Styler |  | Function used to return formatting for individual links, based on the given parameters. |
| link.tension | Ratio |  | Tension of the links. 0 gives a maximally curved link, and 1 gives a straight line. |
| link.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| link.fillOpacity | Opacity |  | The opacity of the fill colour. |
| link.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| link.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| link.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| link.lineDash | PixelSize[] |  | An array specifying the length in pixels of alternating dashes and gaps. |
| link.lineDashOffset | PixelSize |  | The initial offset of the dashed line in pixels. |
| node | AgChordSeriesNodeOptions |  | Options for the nodes. |
| node.spacing | PixelSize |  | Minimum spacing between the nodes. |
| node.width | PixelSize |  | Width of the nodes. |
| node.itemStyler | Styler |  | Function used to return formatting for individual nodes, based on the given parameters. |
| node.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| node.fillOpacity | Opacity |  | The opacity of the fill colour. |
| node.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| node.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| node.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| node.lineDash | PixelSize[] |  | An array specifying the length in pixels of alternating dashes and gaps. |
| node.lineDashOffset | PixelSize |  | The initial offset of the dashed line in pixels. |
| tooltip | AgSeriesTooltip |  | Series-specific tooltip configuration. |
| tooltip.enabled | boolean |  | Whether to show tooltips when the series are hovered over. |
| tooltip.showArrow | boolean |  | The tooltip arrow is displayed by default, unless the container restricts it or a position offset is provided. To always display the arrow, set `showArrow` to `true`. To remove the arrow, set `showArrow` to `false`. |
| tooltip.range | PixelSize \| 'exact' \| 'nearest' \| 'area' |  | Range from a point that triggers the tooltip to show. Each series type uses its own default; typically this is `'nearest'` for marker-based series and `'exact'` for shape-based series. |
| tooltip.position | AgTooltipPositionOptions |  | The position of the tooltip. Each series type uses its own default; typically this is `'node'` for marker-based series and `'pointer'` for shape-based series. |
| tooltip.position.anchorTo | AgTooltipAnchorTo |  | The element or point to position the tooltip relative to. |
| tooltip.position.placement | AgTooltipPlacement \| AgTooltipPlacement[] |  | The positioning of the tooltip in relation to the element it's anchored to. Multiple values can be provided as a fallback mechanism for the case the tooltip does not fit inside the chart. |
| tooltip.position.xOffset | PixelSize |  | The horizontal offset in pixels for the position of the tooltip. |
| tooltip.position.yOffset | PixelSize |  | The vertical offset in pixels for the position of the tooltip. |
| tooltip.position.offset | PixelSize |  | The distance in pixels between the tooltip and its anchor point, applied in the placement direction.  Default: `12` (`0` when `anchorTo` is `'chart'`). |
| tooltip.interaction | AgSeriesTooltipInteraction |  | Configuration for tooltip interaction. |
| tooltip.interaction.enabled (required) | boolean |  | Set to `true` to keep the tooltip open when the mouse is hovering over it, and enable clicking tooltip text |
| tooltip.renderer | Renderer |  | Function used to create the content for tooltips. |
