Check out the tutorial.
Here's what changed in this repo from v3 to v4:
d3.scale.category20b()
becamed3.scaleOrdinal(d3.schemeCategory20b)
d3.svg.arc()
becamed3.arc()
innerRadius()
needs to be explicitly defined so it is now.innerRadius(0)
for the pie chartd3.layout.pie()
becamed3.pie()