I’m back for another addition of d3.js for noobs. I’m a professional developer but I’m no d3.js pro, but I believe I’ve learned a few things that could be useful.
marginContainer.append( 'path' )
.datum( startData )
.attr('class', 'line')
.attr( 'd', line )
.transition()
.duration( 500 )
.ease('quad')
.attrTween( 'd', function() {
var interpolator = d3.interpolateArray( startData, data );
return function( t ) {
return line( interpolator( t ) );
}
} )
.each('end', function() {
drawCircles( data, marginContainer );
});
So last time we got to the point where we’re calling the drawCircles() function. When you use .each('end', function(){ the function gets called at the end of each selection. In this case we only have one selection.