When do I need to use, or not use, .datum when appending an svg element
Posted
by
Bobby Gifford
on Stack Overflow
See other posts from Stack Overflow
or by Bobby Gifford
Published on 2012-11-01T16:17:15Z
Indexed on
2012/11/01
17:01 UTC
Read the original article
Hit count: 242
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);
© Stack Overflow or respective owner