Git Product home page Git Product logo

d3-sankey's Introduction

d3-sankey

D3 4.0 implementation of the Sankey plugin to visualize the flow between nodes in a directed acyclic network.

Installing

If you use NPM, npm install d3-sankey. Otherwise, download the latest release.

Demo

Here is Mike Bostock's famous example recreated with d3-sankey.

Clone or download the block, then run npm install and npm run build to create d3.min.js.

API Reference

# sankey()

Constructs a new sankey generator with the default settings.

# sankey.nodeWidth([width])

If width is specified, sets the node width to the specified function or number and returns this sankey generator. If width is not specified, returns the current node width accessor, which defaults to:

function nodeWidth() {
  return 24;
}

# sankey.nodePadding([padding])

If padding is specified, sets the node padding to the specified function or number and returns this sankey generator. If padding is not specified, returns the current node padding accessor, which defaults to:

function nodePadding() {
  return 8;
}

Here padding refers to the vertical space between nodes that occupy the same horizontal space.

# sankey.nodes([nodes])

If nodes is specified, sets the list of nodes to the specified function or array and returns this sankey generator. If nodes is not specified, returns the current accessor to the list of nodes, which defaults to:

function nodes() {
  return [];
}

# sankey.links([links])

If links is specified, sets the list of links to the specified function or array and returns this sankey generator. If links is not specified, returns the current accessor to the list of links, which defaults to:

function links() {
  return [];
}

# sankey.layout([iterations])

Returns the current accessor to the SVG layout object. Here iterations is the number of times the converging function computeNodeDepths is run.

# sankey.relayout()

Similar to layout but only recalculates the depth of links. Primarily used when a node is moved vertically.

d3-sankey's People

Contributors

mbostock avatar

Forkers

rwzhao

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.