Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-chord

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-chord

Visualize relationships or network flow with an aesthetically-pleasing circular layout.

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9M
decreased by-35%
Maintainers
2
Weekly downloads
 
Created

What is d3-chord?

The d3-chord npm package is a part of the D3.js library that provides tools for creating chord diagrams. Chord diagrams are a graphical method of displaying the inter-relationships between data in a matrix format. This package is particularly useful for visualizing complex relationships in a clear and aesthetically pleasing way.

What are d3-chord's main functionalities?

Generate Chord Layout

This feature allows you to generate a chord layout from a given matrix. The code sample demonstrates how to create a chord layout with padding between groups and sorting subgroups in descending order.

const d3 = require('d3-chord');
const matrix = [
  [11975,  5871, 8916, 2868],
  [ 1951, 10048, 2060, 6171],
  [ 8010, 16145, 8090, 8045],
  [ 1013,   990,  940, 6907]
];
const chord = d3.chord().padAngle(0.05).sortSubgroups(d3.descending);
const chords = chord(matrix);
console.log(chords);

Create Ribbon Paths

This feature allows you to create ribbon paths for the chords. The code sample demonstrates how to create a ribbon path with a specified radius.

const d3 = require('d3-chord');
const ribbon = d3.ribbon().radius(200);
const pathData = ribbon({
  source: {startAngle: 0, endAngle: Math.PI / 2, radius: 200},
  target: {startAngle: Math.PI, endAngle: 3 * Math.PI / 2, radius: 200}
});
console.log(pathData);

Customize Chord Diagram

This feature allows you to customize the chord diagram by adjusting the padding angle and sorting the chords. The code sample demonstrates how to create a chord layout with a larger padding angle and sorting the chords in ascending order.

const d3 = require('d3-chord');
const chord = d3.chord().padAngle(0.1).sortChords(d3.ascending);
const matrix = [
  [11975,  5871, 8916, 2868],
  [ 1951, 10048, 2060, 6171],
  [ 8010, 16145, 8090, 8045],
  [ 1013,   990,  940, 6907]
];
const chords = chord(matrix);
console.log(chords);

Other packages similar to d3-chord

Keywords

FAQs

Package last updated on 05 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc