I ran into a strange argument I haven't seen. In this code, it puts 'null' into attribute and I guess what this null is doing is receive things when the function is being chained with others.
1) I want to ask you guys what the null is doing. ( where the null is in the code below)
var t = svg.selectAll(".symbol").transition()
.duration(duration)
.attr("transform", "translate(0,0)")
.each("end", function() { d3.select(this).attr("transform", null); });
t.select("path.area")
.attr("d", function(d) { return area(d.values); });
t.select("path.line")
.style("stroke-opacity", function(d, i) { return i < 3 ? 1e-6 : 1; })
.attr("d", function(d) { return line(d.values); });
t.select("text")
.attr("transform", function(d) { d = d.values[d.values.length - 1]; return "translate(" + (w - 60) + "," + y(d.price / 2 + d.price0) + ")"; });
setTimeout(streamgraph, duration + delay);
2) I assume, the variable t is written to avoid repetitive transform argument. However, I don't get the order of the argument. Because I think, it should be written following this order.
svg.selectAll('.symbol').select('path.area').attr('d',function(d){return area(d.values);}) .transition().duration(duration).attr('transform','translate(0,0)')....
However, according to the var t, select('path.area') comes after transition and duration and even after .each.
3) Last question, For the version 4 and 5 .each('end'...) needs to be .on('end'.... right?