npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

d3-multichord

v0.0.2

Published

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

Downloads

6

Readme

d3-multichord

Circular layout for visualizing relationships or network flows with multiple types. This is a modification of d3-chord to enable another dimension of data to be shown between nodes.

A common example for d3.chord is the Uber dataset, showing trips between

Installing

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](REFERENCE BLOCK HERE):

var matrix = [
    [[0,0,0],[49,0,6],[236,1,18],[135,11,6]],
    [[37,1,9],[0,0,0],[230,9,19],[94,3,0]],
    [[295,6,24],[282,8,25],[0,0,0],[323,18,29]],
    [[181,5,16],[107,13,13],[195,6,26],[0,0,0]]
];

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