This is the code for Chapter 12, Figure 7 from D3.js in Action which requires a touch interface (or emulator) to see any effect. This example uses data from d3.touches() to implement rotate by calculate the initial angle of the touches and rotating the SVG g element based on the current rotation of the touches.
You can see a more advanced visual explanation of how this calculation is made in this example.
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js