I haven't made a full extension myself but this seems like a viable tutorial:
Are you using this d3 object?
My suggestion is to first read the tutorial, and then take a look at the Qlik branch projects that use d3.
Find something that most closely resembles what you are trying to make, and then check out the code. It's most likely on Github.