This example is no longer maintained. You can still access the code below, but it may use an old version of D3, have bugs, lack comments, or otherwise not represent current best practices.
The D3 team now maintains examples and tutorials on Observable, the best place to collaborate on visualization. Observable makes it easy to play with, fork, import, and share code on the web. You can download or embed whatever you make on Observable so it can live anywhere on the web (or off of it).