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.