Socket
Socket
Sign inDemoInstall

d3-sankey

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-sankey - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

4

dist/d3-sankey.js

@@ -1,2 +0,2 @@

// https://github.com/d3/d3-sankey v0.8.0 Copyright 2019 Mike Bostock
// https://github.com/d3/d3-sankey v0.8.1 Copyright 2019 Mike Bostock
(function (global, factory) {

@@ -78,3 +78,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-shape')) :

links = defaultLinks,
iterations = 1;
iterations = 6;

@@ -81,0 +81,0 @@ function sankey() {

@@ -1,2 +0,2 @@

// https://github.com/d3/d3-sankey v0.8.0 Copyright 2019 Mike Bostock
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-collection"),require("d3-shape")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-shape"],t):t((n=n||self).d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(n,t,e,r){"use strict";function o(n){return n.target.depth}function u(n,t){return n.sourceLinks.length?n.depth:t-1}function i(n){return function(){return n}}function c(n,t){return s(n.source,t.source)||n.index-t.index}function f(n,t){return s(n.target,t.target)||n.index-t.index}function s(n,t){return n.y0-t.y0}function a(n){return n.value}function h(n){return n.index}function d(n){return n.nodes}function l(n){return n.links}function y(n,t){var e=n.get(t);if(!e)throw new Error("missing: "+t);return e}function g(n){return[n.source.x1,n.y0]}function k(n){return[n.target.x0,n.y1]}n.sankey=function(){var n=0,r=0,o=1,g=1,k=24,p=8,v=h,L=u,E=d,x=l,m=1;function w(){var u={nodes:E.apply(null,arguments),links:x.apply(null,arguments)};return function(n){n.nodes.forEach(function(n,t){n.index=t,n.sourceLinks=[],n.targetLinks=[]});var t=e.map(n.nodes,v);n.links.forEach(function(n,e){n.index=e;var r=n.source,o=n.target;"object"!=typeof r&&(r=n.source=y(t,r)),"object"!=typeof o&&(o=n.target=y(t,o)),r.sourceLinks.push(n),o.targetLinks.push(n)})}(u),function(n){n.nodes.forEach(function(n){n.value=Math.max(t.sum(n.sourceLinks,a),t.sum(n.targetLinks,a))})}(u),function(t){var e,r,u;for(e=t.nodes,r=[],u=0;e.length;++u,e=r,r=[])e.forEach(function(n){n.depth=u,n.sourceLinks.forEach(function(n){r.indexOf(n.target)<0&&r.push(n.target)})});for(e=t.nodes,r=[],u=0;e.length;++u,e=r,r=[])e.forEach(function(n){n.height=u,n.targetLinks.forEach(function(n){r.indexOf(n.source)<0&&r.push(n.source)})});var i=(o-n-k)/(u-1);t.nodes.forEach(function(t){t.x1=(t.x0=n+Math.max(0,Math.min(u-1,Math.floor(L.call(null,t,u))))*i)+k})}(u),function(n){var o,u=e.nest().key(function(n){return n.x0}).sortKeys(t.ascending).entries(n.nodes).map(function(n){return n.values});o=t.min(u,function(n){return(g-r-(n.length-1)*p)/t.sum(n,a)}),u.forEach(function(n){n.forEach(function(n,t){n.y1=(n.y0=t)+n.value*o})}),n.links.forEach(function(n){n.width=n.value*o}),y();for(var i=.9,h=m;h>0;--h,i*=.9)l(i),y(),d(i),y();function d(n){u.forEach(function(t){t.forEach(function(t){let e=t.y0;for(const{target:r,width:o,value:u}of t.sourceLinks.sort(f)){let i=0;for(const n of r.targetLinks){if(n.source===t)break;i+=n.width+p/2}const c=(e-i-r.y0)*n*(u/Math.min(t.value,r.value));r.y0+=c,r.y1+=c,e+=o+p/2}})})}function l(n){u.slice().reverse().forEach(function(t){t.forEach(function(t){let e=t.y0;for(const{source:r,width:o,value:u}of t.targetLinks.sort(c)){let i=0;for(const n of r.sourceLinks){if(n.target===t)break;i+=n.width+p/2}const c=(e-i-r.y0)*n*(u/Math.min(t.value,r.value));r.y0+=c,r.y1+=c,e+=o+p/2}})})}function y(){u.forEach(function(n){var t,e,o,u=r,i=n.length;for(n.sort(s),o=0;o<i;++o)t=n[o],(e=u-t.y0)>0&&(t.y0+=e,t.y1+=e),u=t.y1+p;if((e=u-p-g)>0)for(u=t.y0-=e,t.y1-=e,o=i-2;o>=0;--o)t=n[o],(e=t.y1+p-u)>0&&(t.y0-=e,t.y1-=e),u=t.y0})}}(u),M(u),u}function M(n){n.nodes.forEach(function(n){n.sourceLinks.sort(f),n.targetLinks.sort(c)}),n.nodes.forEach(function(n){var t=n.y0,e=t;n.sourceLinks.forEach(function(n){n.y0=t+n.width/2,t+=n.width}),n.targetLinks.forEach(function(n){n.y1=e+n.width/2,e+=n.width})})}return w.update=function(n){return M(n),n},w.nodeId=function(n){return arguments.length?(v="function"==typeof n?n:i(n),w):v},w.nodeAlign=function(n){return arguments.length?(L="function"==typeof n?n:i(n),w):L},w.nodeWidth=function(n){return arguments.length?(k=+n,w):k},w.nodePadding=function(n){return arguments.length?(p=+n,w):p},w.nodes=function(n){return arguments.length?(E="function"==typeof n?n:i(n),w):E},w.links=function(n){return arguments.length?(x="function"==typeof n?n:i(n),w):x},w.size=function(t){return arguments.length?(n=r=0,o=+t[0],g=+t[1],w):[o-n,g-r]},w.extent=function(t){return arguments.length?(n=+t[0][0],o=+t[1][0],r=+t[0][1],g=+t[1][1],w):[[n,r],[o,g]]},w.iterations=function(n){return arguments.length?(m=+n,w):m},w},n.sankeyCenter=function(n){return n.targetLinks.length?n.depth:n.sourceLinks.length?t.min(n.sourceLinks,o)-1:0},n.sankeyLeft=function(n){return n.depth},n.sankeyRight=function(n,t){return t-1-n.height},n.sankeyJustify=u,n.sankeyLinkHorizontal=function(){return r.linkHorizontal().source(g).target(k)},Object.defineProperty(n,"__esModule",{value:!0})});
// https://github.com/d3/d3-sankey v0.8.1 Copyright 2019 Mike Bostock
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-collection"),require("d3-shape")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-shape"],t):t((n=n||self).d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(n,t,e,r){"use strict";function o(n){return n.target.depth}function u(n,t){return n.sourceLinks.length?n.depth:t-1}function i(n){return function(){return n}}function c(n,t){return s(n.source,t.source)||n.index-t.index}function f(n,t){return s(n.target,t.target)||n.index-t.index}function s(n,t){return n.y0-t.y0}function a(n){return n.value}function h(n){return n.index}function d(n){return n.nodes}function l(n){return n.links}function y(n,t){var e=n.get(t);if(!e)throw new Error("missing: "+t);return e}function g(n){return[n.source.x1,n.y0]}function k(n){return[n.target.x0,n.y1]}n.sankey=function(){var n=0,r=0,o=1,g=1,k=24,p=8,v=h,L=u,E=d,x=l,m=6;function w(){var u={nodes:E.apply(null,arguments),links:x.apply(null,arguments)};return function(n){n.nodes.forEach(function(n,t){n.index=t,n.sourceLinks=[],n.targetLinks=[]});var t=e.map(n.nodes,v);n.links.forEach(function(n,e){n.index=e;var r=n.source,o=n.target;"object"!=typeof r&&(r=n.source=y(t,r)),"object"!=typeof o&&(o=n.target=y(t,o)),r.sourceLinks.push(n),o.targetLinks.push(n)})}(u),function(n){n.nodes.forEach(function(n){n.value=Math.max(t.sum(n.sourceLinks,a),t.sum(n.targetLinks,a))})}(u),function(t){var e,r,u;for(e=t.nodes,r=[],u=0;e.length;++u,e=r,r=[])e.forEach(function(n){n.depth=u,n.sourceLinks.forEach(function(n){r.indexOf(n.target)<0&&r.push(n.target)})});for(e=t.nodes,r=[],u=0;e.length;++u,e=r,r=[])e.forEach(function(n){n.height=u,n.targetLinks.forEach(function(n){r.indexOf(n.source)<0&&r.push(n.source)})});var i=(o-n-k)/(u-1);t.nodes.forEach(function(t){t.x1=(t.x0=n+Math.max(0,Math.min(u-1,Math.floor(L.call(null,t,u))))*i)+k})}(u),function(n){var o,u=e.nest().key(function(n){return n.x0}).sortKeys(t.ascending).entries(n.nodes).map(function(n){return n.values});o=t.min(u,function(n){return(g-r-(n.length-1)*p)/t.sum(n,a)}),u.forEach(function(n){n.forEach(function(n,t){n.y1=(n.y0=t)+n.value*o})}),n.links.forEach(function(n){n.width=n.value*o}),y();for(var i=.9,h=m;h>0;--h,i*=.9)l(i),y(),d(i),y();function d(n){u.forEach(function(t){t.forEach(function(t){let e=t.y0;for(const{target:r,width:o,value:u}of t.sourceLinks.sort(f)){let i=0;for(const n of r.targetLinks){if(n.source===t)break;i+=n.width+p/2}const c=(e-i-r.y0)*n*(u/Math.min(t.value,r.value));r.y0+=c,r.y1+=c,e+=o+p/2}})})}function l(n){u.slice().reverse().forEach(function(t){t.forEach(function(t){let e=t.y0;for(const{source:r,width:o,value:u}of t.targetLinks.sort(c)){let i=0;for(const n of r.sourceLinks){if(n.target===t)break;i+=n.width+p/2}const c=(e-i-r.y0)*n*(u/Math.min(t.value,r.value));r.y0+=c,r.y1+=c,e+=o+p/2}})})}function y(){u.forEach(function(n){var t,e,o,u=r,i=n.length;for(n.sort(s),o=0;o<i;++o)t=n[o],(e=u-t.y0)>0&&(t.y0+=e,t.y1+=e),u=t.y1+p;if((e=u-p-g)>0)for(u=t.y0-=e,t.y1-=e,o=i-2;o>=0;--o)t=n[o],(e=t.y1+p-u)>0&&(t.y0-=e,t.y1-=e),u=t.y0})}}(u),M(u),u}function M(n){n.nodes.forEach(function(n){n.sourceLinks.sort(f),n.targetLinks.sort(c)}),n.nodes.forEach(function(n){var t=n.y0,e=t;n.sourceLinks.forEach(function(n){n.y0=t+n.width/2,t+=n.width}),n.targetLinks.forEach(function(n){n.y1=e+n.width/2,e+=n.width})})}return w.update=function(n){return M(n),n},w.nodeId=function(n){return arguments.length?(v="function"==typeof n?n:i(n),w):v},w.nodeAlign=function(n){return arguments.length?(L="function"==typeof n?n:i(n),w):L},w.nodeWidth=function(n){return arguments.length?(k=+n,w):k},w.nodePadding=function(n){return arguments.length?(p=+n,w):p},w.nodes=function(n){return arguments.length?(E="function"==typeof n?n:i(n),w):E},w.links=function(n){return arguments.length?(x="function"==typeof n?n:i(n),w):x},w.size=function(t){return arguments.length?(n=r=0,o=+t[0],g=+t[1],w):[o-n,g-r]},w.extent=function(t){return arguments.length?(n=+t[0][0],o=+t[1][0],r=+t[0][1],g=+t[1][1],w):[[n,r],[o,g]]},w.iterations=function(n){return arguments.length?(m=+n,w):m},w},n.sankeyCenter=function(n){return n.targetLinks.length?n.depth:n.sourceLinks.length?t.min(n.sourceLinks,o)-1:0},n.sankeyLeft=function(n){return n.depth},n.sankeyRight=function(n,t){return t-1-n.height},n.sankeyJustify=u,n.sankeyLinkHorizontal=function(){return r.linkHorizontal().source(g).target(k)},Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "d3-sankey",
"version": "0.8.0",
"version": "0.8.1",
"description": "Visualize flow between nodes in a directed acyclic network.",

@@ -27,3 +27,3 @@ "keywords": [

"prepublishOnly": "rm -rf dist && yarn test",
"postpublish": "git push && git push --tags && zip -j build/d3-sankey.zip -- LICENSE README.md build/d3-sankey.js build/d3-sankey.min.js"
"postpublish": "git push && git push --tags && zip -j dist/d3-sankey.zip -- LICENSE README.md dist/d3-sankey.js dist/d3-sankey.min.js"
},

@@ -30,0 +30,0 @@ "dependencies": {

@@ -178,3 +178,3 @@ # d3-sankey

If *iterations* is specified, sets the number of relaxation iterations when [generating the layout](#_sankey) and returns this Sankey generator. If *iterations* is not specified, returns the current number of relaxation iterations, which defaults to 1.
If *iterations* is specified, sets the number of relaxation iterations when [generating the layout](#_sankey) and returns this Sankey generator. If *iterations* is not specified, returns the current number of relaxation iterations, which defaults to 6.

@@ -181,0 +181,0 @@ ### Alignments

@@ -48,3 +48,3 @@ import {ascending, min, sum} from "d3-array";

links = defaultLinks,
iterations = 1;
iterations = 6;

@@ -51,0 +51,0 @@ function sankey() {

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