Are you sure of the API of apply method ? 
I rather expected a datum and an optional index, as specified in the diagonal method :https://github.com/mbostock/d3/wiki/SVG-Shapes#wiki-_diagonal