score:1

Accepted answer

The g element that contains all the drawing elements is translated to the center of the svg:

 .append("g")
  .attr({
    transform: "translate(" + w / 2 + "," + h / 2 + ")"
  });

This gives all future elements coordinate 0,0 as the center of the svg.


Related Query

More Query from same tag