Accessing the D3 documentation for older versions

Fri 18 September 2020

D3 moves fast:

I try to keep up, but inevitably have lots of production code, tutorials, and examples still in older versions (the biggest project I maintain, hedonometer.org, is on v3...eek!). Keeping all of that running would be impossible without the documentation for that code, and thankfully we can still access everything because of how well the D3 team uses git, git tags, and the GitHub releases feature.

You can access any older, or the current version of d3 itself through npmjs, here’s the link to v4.13. The instructions there show you how to use that version through npm, through cdnjs, etc.

D3 itself, if you've made it this far you know, is a collection of submodules. The main repository on GitHub is: https://github.com/d3/d3. This bundles most, but not all, of the submodules (notes on how to add additional modules are in the npmjs instruction above and in the readme on the GitHub).

For accessing the older version of d3 on GitHub, you can click on the “tags” button, and scroll back to version v4.13, you’ll end up on this link to the tag itself: https://github.com/d3/d3/releases/tag/v4.13.0.

If you go from there to click on the commit tag (it looks like dd87262), you’ll be here: https://github.com/d3/d3/commit/dd87262... and then you can click “browse files” to get back to the main repo pack at that specific release commit: https://github.com/d3/d3/tree/dd87262...

From that version of the repo, you can access the API doc by clicking on the API.md file, so that’s the docs for v4.13! If you didn’t follow all of the clicks, here it is: https://github.com/d3/d3/blob/dd87262/API.md.

Now, some of the references in there refer you to the submodules, like clicking d3.selection, it will send you here: https://github.com/d3/d3-selection/blob/master/README.md#selection. Well, damn, that’s the latest release of d3-selection, not the one bundled in d3 v4.13. But not to worry, back on the main repo pack for the v4.13 commit, navigate to the index.js file and you’ll see all of the pinned dependencies. For d3-selection, it’s this line: https://github.com/d3/d3/blob/dd87262/package.json#L66

Phew, now on the d3-selection repo, you can follow the same steps: - Go to tags, - scroll to version 1.3.0, - click that one, - click the commit tag, - click browse files. You’re back at v1.3.0 of d3-selection with the code and documentation as it was when v1.3.0 was released.

A bit of a saga, but in short you can find any version of d3, the submodules, and their documentation through GitHub. It’s a good exercise in getting familiar with tagging releases with git (git tag v0.0.1; git push origin --tags;), just how powerful that can be if done right, and navigating around GitHub.