title: X-position of Sankey nodes in d3
body: <p><a href="http://i.stack.imgur.com/7cp9j.png" rel="nofollow">This is my Sankey diagram showing the attrition of sexual assault cases that are reported to the police in New Zealand</a></p>
  
  <p><a href="http://i.stack.imgur.com/Fl4lx.png" rel="nofollow">This is the data I am drawing from</a></p>
  
  <p>Because it's a diagram to show attrition; I want to the nodes to stack vertically so that there should only be 3 nodes on the far right, and at each level of the process, the nodes should stack on top of one another. I can't figure out why they are all clustering on the right. </p>
  
  <p>I think the issue is in the computeNodeBreaths function of the plugin I am using, but I can't figure out how to fix it.</p>
  
  <p>function computeNodeBreadths() {
      var remainingNodes = nodes,
          nextNodes,
          x = 0;</p>
  
  <pre><code>while (remainingNodes.length) {
    nextNodes = [];
    remainingNodes.forEach(function(node) {
      node.x = x;
      node.dx = nodeWidth;
      node.sourceLinks.forEach(function(link) {
        if (nextNodes.indexOf(link.target) &lt; 0) {
          nextNodes.push(link.target);
        }
      });
    });
    remainingNodes = nextNodes;
    ++x;
  }
  </code></pre>
  
  <p>Any advice would be very much appreciated.</p>
  
  <p>Thanks</p>