Chord Charts and Diagrams

Note: See our Chord Chart Gallery for inspiration on all the different chord chart possibilities.

Chord Chart Type

In your chart object, add a type attribute and set the value to chord.

{
  type: "chord"
}
https://app.zingsoft.com/demos/embed/TDWFZJKE
https://app.zingsoft.com/demos/embed/TDWFZJKE

Data

Chord charts support data in the form of a series array of objects.

Number Arrays

Create a series array of objects of length N. Within each of those objects, place a values array with a length equal to the number of objects within the series array.

{
  type: "chord",
  series: [ // Length N array of objects
    {
      values: [val1, val2, ..., valN] // Length N array of numbers
    },
    {
      values: [val1, val2, ..., valN]
    }
      ...,
    {
      values: [val1, val2, ..., valN]
    }
  ]
}

Chord Chart-Specific Properties

Customize how chord segments and bands display via the options object.

Angle Padding

The angle-padding attribute sets the angle padding between two chord segments.

{
  "options": {
    "angle-padding": 0
  }
}

In the chart below, compare 'angle-padding':0 with 'angle-padding':50:

https://app.zingsoft.com/demos/embed/IMDR5LDJ
https://app.zingsoft.com/demos/embed/IMDR5LDJ

Band Space

The band-space attribute sets the space between the band and the chords.

{
  "options": {
    "band-space": 10
  }
}

In the chart below, compare 'band-space':10 with 'band-space':50:

https://app.zingsoft.com/demos/embed/PV578DVL
https://app.zingsoft.com/demos/embed/PV578DVL

Band Width

The band-width attribute sets the width of the band.

{
  "options": {
    "band-width": 10
  }
}

In the chart below, compare 'band-width': 10 with 'band-width':50:

https://app.zingsoft.com/demos/embed/3WQ6SHRB
https://app.zingsoft.com/demos/embed/3WQ6SHRB

Flat

The flat attribute sets whether the chord's highlight effect (when hovering over the band) is enabled or not. Setting the flat attribute to true will disable the highlight effect when hovering over the band.

{
  type: "chord",
  options: {
    flat: true
  }
}
https://app.zingsoft.com/demos/embed/KMMSZG14
https://app.zingsoft.com/demos/embed/KMMSZG14

Radius

The radius attribute sets the radius of the chord. The value can be relative to the plotarea size.

{
  "options": {
    "radius": 60
  }
}

In the chart below, compare radius:120 with radius:60:

https://app.zingsoft.com/demos/embed/1RFQDX5N
https://app.zingsoft.com/demos/embed/1RFQDX5N

Further Customization

Chord charts also include a number of global stylings that allow you to manipulate the appearance and behaviors of your chord chart. They can be implemented into your chart by placing them within the options object.

Note: For more styling options, browse our JSON Attributes/Syntax page.

Color Type

The color-type attribute sets the color algorithm used to color the items.

Random

Setting 'color-type': "random" lets the library choose random colors each time the chart renders.

{
  options: {
    'color-type': "random"
  }
}
https://app.zingsoft.com/demos/embed/WBKCKQLW
https://app.zingsoft.com/demos/embed/WBKCKQLW

Color

The color attribute sets the color of the items when 'color-type': "color" is set. Provide a color, HEX, or RGB value.

{
  options: {
    'color-type': "color",
    color: "#f90"
  }
}
https://app.zingsoft.com/demos/embed/PRIABRCA
https://app.zingsoft.com/demos/embed/PRIABRCA

Palette

The palette attribute defines a custom palette used by the items when 'color-type is set to palette. Provide a string of comma separated color, HEX, or RGB values.

{
  options: {
    'color-type': "palette",
    palette: [ "#15252d", "#768766", "#e5db82", "#bb9944", "#bb6622", "#b1200f", "#342e3a" ]
  }
}
https://app.zingsoft.com/demos/embed/YTX215RV
https://app.zingsoft.com/demos/embed/YTX215RV

Band

The band attribute defines the global or series styling for the band. To style globally, create a style object and insert your band object.

{
  options: {
    style: {
      band: {
        'border-width':4,
        'border-color': "#900"
      }
    }
  }
}

To style by series, create a style object within the series array you want to apply your styling to and insert your band object.

{
  series: [
    {
      values: [6637,5700,4789,2771],
      text: "A",
      style: {
        band: {
          'border-width':4
        }
      }
    }
  ]
}
https://app.zingsoft.com/demos/embed/ZE1WI8VA
https://app.zingsoft.com/demos/embed/ZE1WI8VA

Chord

The chord attribute defines the global or series styling for the chords. To style globally, create a style object and insert your chord object.

{
  options: {
    style: {
      chord: {
        'border-width':4,
        'border-color': "#900"
      }
    }
  }
}

To style by series, create a style object within the series array you want to apply your styling to and insert your chord object.

{
  series: [
    {
      values: [6637,5700,4789,2771],
      text: "A",
      style: {
        chord: {
        'border-width':4,
        'border-color': "#900"
        }
      }
    }
  ]
}
https://app.zingsoft.com/demos/embed/SP2SE9CH
https://app.zingsoft.com/demos/embed/SP2SE9CH

Label

The label attribute defines the global or series styling for the labels. To style globally, create a style object and insert your label object.

Note: Learn more about labels with our Labels Tutorial and labels JSON Configuration page.

{
  options: {
    style: {
      label: {
        color: "#900"
      }
    }
  }
}
https://app.zingsoft.com/demos/embed/2EPG0PYR
https://app.zingsoft.com/demos/embed/2EPG0PYR

To style by series, create a style object within the series array you want to apply your styling to and insert your label object.

{
  series: [
    {
      values: [6637,5700,4789,2771],
      text: "A",
      style: {
        label: {
          color: "#090"
        }
      }
    }
  ]
}
https://app.zingsoft.com/demos/embed/2Q8K6FA5
https://app.zingsoft.com/demos/embed/2Q8K6FA5

Tick

The tick attribute defines the global or series styling for the ticks. To style globally, create a style object and insert your tick object.

Note: Learn more about tick styling options with our tick JSON Configuration page.

{
   options: {
    style: {
      tick: {
        size:6,
        'line-color': "#900"
      }
    }
  }
}

To style by series, create a style object within the series array you want to apply your styling to and insert your label object.

{
  series: [
    {
      values: [6637,5700,4789,2771],
      text: "A",
      style: {
        tick: {
          size: 6
        }
      }
    }
  ]
}
https://app.zingsoft.com/demos/embed/4G2OFKOQ
https://app.zingsoft.com/demos/embed/4G2OFKOQ

Tooltips

The tooltip attribute defines the global or series styling for the tooltips. To enable tooltips, you will need to add a tooltip attribute to the band and chord objects.

To style tooltips globally, create a style object and insert your tooltip object.

Note: Learn more about tooltips with our Tooltips Tutorial and tooltip JSON Configuration page.

{
  options: {
    style: {
      tooltip: {
        'border-width':2,
        'border-color': "#900",
        'background-color': "#fc0"
      },
      band: {
        tooltip: {
          text: "Band of item %text"
        }
      },
      chord: {
        tooltip: {
          'text-chord': "Chord between %text-source (%value-source) and %text-destination (%value-destination)",
          text: "Self-chord of item %text with value %value"
        }
      }
    }
  }
}
https://app.zingsoft.com/demos/embed/8JZBCYWV
https://app.zingsoft.com/demos/embed/8JZBCYWV

To style by series, create a style object within the series array you want to apply your styling to and insert your tooltip object.

{
  series: [
    {
      values: [6637,5700,4789,2771],
      text: "A",
      style: {
        tooltip: {
          'background-color': "#090",
          color: "#fff"
        },
        band: {
          tooltip: {
            text: "Specific text for band of item %text"
          }
        },
        chord: {
          tooltip: {
            'text-chord': "%text-source/%value-source links to %text-destination/%value-destination",
            text: "%text has value %value"
          }
        }
      }
    }
  ]
}
https://app.zingsoft.com/demos/embed/3YQHR7W7
https://app.zingsoft.com/demos/embed/3YQHR7W7

Summary

Have questions about how chord diagram charts work? We're happy to help! Email support@zingchart.com or start a chat right here on this page for support.