I'm not sure what problem you are encountering here but there should be no need to include the D3 library.
I've just re-run my code as published and it works fine (except that because of the way that Medium treats pasted quotes, these are a bit of a mess - I'll go back to the article and fix them).