Skip to content

micahstubbs/d3-adjacency-matrix-layout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

d3-adjacency-matrix-layout

a d3 version 4 port of the adjacencyMatrix d3-plugin from @Elijah_Meeks

see the layout in use at http://bl.ocks.org/micahstubbs/7f360cc66abfa28b400b96bc75b8984e

develop with es2015 then bundle and transpile to todays-browsers-friendly es5 Javascript with the command
npm run prepublish

Download

build/d3-adjacency-matrix-layout.js

API Reference

matrix.size An array of [width, height] that is used to calculate grid x, y, height and width.

matrix.nodes An array of the nodes of your network.

matrix.links An array of the edges of your network. As with other D3 network layouts, if the source and target properties are numbers, they are assumed to be array position within the nodes array, otherwise objects are assumed.

matrix.edgeWeight The function to return the weight of the edges of your links, if any. Defaults to returning 1.

matrix.nodeID The function to return the id value of a node, defaults to returning #node.id. The id is used to build the matrix and drive the axes.

matrix.xAxis Cannot be set. Call this from the same place where you've put your matrix cells and it will build a simple horizontal axis with labels from your node id.

matrix.yAxis Cannot be set. Call this from the same place where you've put your matrix cells and it will build a simple vertical axis with labels from your node id.

matrix.directed Set to false if you want to mirror undirected networks.

d3-adjacency-matrix example

About

an adjacency matrix layout for d3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published