How to make reversed phylogenetic tree in d3.js?

Hi, I’m making a reversed tree based on the example in the d3.js documentation. And I need to somehow turn this tree inside out like in the picture. But I don’t know how to do it, maybe there is some option in hierarchy that changes the order of data or it can be done in some other way?

Thanks in advance for your help!

Result I want to achieve:

I don’t have a solution, but after staring at the code for a bit, I figure inverting the math in the setRadius() function should at least get you to the inverted layout. The text will probably need special handling too, but from just looking over the code, most of the rest doesn’t seem to really care which way around the tree is being drawn.