Look at the code of the basic d3 mapping workshop of the #jpd15.
The slides and the explanation in this link (although in Spanish).