title: D3js: When to use .datum() and .data()?
body: <p>I often see <code>.datum</code> when an area chart is used.  For example: </p>
  
  <pre><code>svg = d3.select("#viz").append("svg").datum(data)
  </code></pre>
  
  <p>Are there any rules of thumb for when <code>.datum</code> is needed?</p>
  
  <pre><code>var area = d3.svg.area()  
      .x(function(d) { return x(d.x); })  
      .y0(height)  
      .y1(function(d) { return y(d.y); });  
  
  var svg = d3.select("body").append("svg")  
      .attr("width", width)  
      .attr("height", height);  
  
  svg.append("path") 
      .datum(data)
      .attr("d", area); 
  </code></pre>