d3.svg.line.radial()

HTML

<script src="http://d3js.org/d3.v2.js"></script>

CSS

.line {
  fill: none;
  stroke: steelblue;
  stroke-width: 1.5px;
}

JavaScript

var radius = 100,
    padding = 10,
    degreeToRadians = Math.PI/180;

var dimension = (2 * radius) + (2 * padding),
    angles = [45,90]; //array of angles in degrees

function arcInterpolator(r) {
    //creates a line interpolator function
    //which will draw an arc of radius `r`
    //between successive polar coordinate points on the line
    
    return function(points) { console.log(points);
    //the function must return a path definition string
    //that can be appended after a "M" command
    
        var allCommands = [];
        
        var startAngle; //save the angle of the previous point
                        //in order to allow comparisons to determine
                        //if this is large arc or not, clockwise or not
                             
        points.forEach(function(point, i) { 
            
            //the points passed in by the line generator
            //will be two-element arrays of the form [x,y]
            //we also need to know the angle:        
            var angle = Math.atan2(point[0], point[1]);
            //console.log("from", startAngle, "to", angle);
            
            var command;
            
            if (i) command = ["A", //draw an arc from the previous point to this point
                        r, //x-radius
                        r, //y-radius (same as x-radius for a circular arc)
                        0, //angle of ellipse (not relevant for circular arc)
                        +(Math.abs(angle - startAngle) > Math.PI), 
                           //large arc flag,
                           //1 if the angle change is greater than 180degrees (pi radians),
                           //0 otherwise
                       +(angle < startAngle), //sweep flag, draws the arc clockwise
                       point[0], //x-coordinate of new point
                       point[1] //y-coordinate of new point
                       ];
            
            else command = point; //i = 0, first...