title: Different shape/image for leaf nodes in pack layout
body: <p>I am using a pack layout in d3.js (<a href="https://github.com/mbostock/d3/wiki/Pack-Layout" rel="nofollow">https://github.com/mbostock/d3/wiki/Pack-Layout</a>) and load in a json file with a parent-child structure.</p>
  
  <p>My question is probably a very trivial one: I would like to append a circle or an image(or maybe a rectangle) depending on whether <code>d.children</code> returns <code>parent</code> or <code>child</code> (where child in basically a leaf node). </p>
  
  <p>This is a bit of the code that appends circles to all nodes:</p>
  
  <pre><code> vis.selectAll("circle")
    .data(nodes)
  .enter().append("svg:circle")
    .attr("class", function(d) { return d.children ? "parent" : "child"; })
    .attr("cx", function(d) { return d.x; })
    .attr("cy", function(d) { return d.y; })
    .attr("r", function(d) { return d.r; });
  </code></pre>
  
  <p>Does anyone have any suggestions?
  Thank you,</p>