This is the little bit of scaffolding I typically use when starting a d3.js project. I typically separate the Javascript from the HTML, but it's included here for convenience. In addition to d3.js v4, this example uses the following additional libraries.
- queue - github.com/d3/d3-queue "running asynchronous tasks with configurable concurrency" (now part of d3 v4).
- jetpack - github.com/gka/d3-jetpack "d3-jetpack is a set of nifty convenience wrappers that speed up your daily work with d3.js"
- starterkit - github.com/1wheel/d3-starterkit "snippets and conventions for starting a new d3 project without a fuss"
Block here: bl.ocks.org/fogonwater/a299c3ea7f4f1fea6ee5eda061113430