When do I need to use, or not use, .datum when appending an svg element
- by Bobby Gifford
svg = d3.select("#viz").append("svg").datum(data)
//I often see .datum when an area chart is used. Are there any rules of thumb for when .datum is needed?
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);