d3 / d3-plugins

[DEPRECATED] A repository for sharing D3.js V3 plugins.

Home Page:https://github.com/d3/d3/wiki/Plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sankey Diagram layout error with 'too many' nodes

benjmyers opened this issue · comments

First off, thanks for the existing work on this plugin!

In using the plugin, I've found that if the number of nodes is large enough and the passed in height small enough, the layout will fail. I initially noticed this by trying to increase nodePadding from its default value. This 'bug' occurs inside initializeNodeDepth() when ky becomes negative.

  var ky = d3.min(nodesByBreadth, function(nodes) {
    return (size[1] - (nodes.length - 1) * nodePadding) / d3.sum(nodes, value);
  });

While mathematically this isn't a bug, I would expect the layout to either not rely on a hard coded height or throw an error if there is not enough vertical space for the quantity of nodes.

I have also encountered this issue, is there an plan to enhance this feature allow the ky to account for the height and width of the svg?

I am having the same problem