d3 / d3-plugins

[DEPRECATED] A repository for sharing D3.js V3 plugins.
https://github.com/d3/d3/wiki/Plugins
Other
1.81k stars 685 forks source link

Sankey Diagram layout error with 'too many' nodes #103

Open benjmyers opened 10 years ago

benjmyers commented 10 years ago

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.

mmmtoasted commented 9 years ago

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?

ckathleen commented 5 years ago

I am having the same problem