I think my first serious attempt to do anything using D3 (click the image for the programmatic version) was probably the hardest thing you could have tried to do in it. As far as I can tell, D3 is designed in such a way that it is ideal where all of the elements in a visualisation can be computed independently of each other. In this chart, the position of the subsequent node is a function of the current node's value, not just its position in a list.
To do this, seems to need global variables to keep track of things (well I suppose I could hide them in a function and do the translation up front, but not ideal and I can't help wondering if there's a better way of doing it). As far as I can tell, there are no 'fold' type functions in D3, although I am new to it; perhaps I haven't found it yet.
Princes Street Gardens is a public park in the centre of Edinburgh, Scotland, in the shadow of Edinburgh Castle. The Gardens were created in two phases in the 1770s and 1820s following the long draining of the Nor Loch and the creation of the New Town.
Inverleith (Scottish Gaelic: Inbhir Lìte) is an inner suburb in the northern part of Edinburgh, Scotland, on the fringes of the central region of the city. It is an affluent suburb. Its neighbours include Trinity to the north and the New Town to the south, with Canonmills at the south-east and Stockbridge at the south-west. Like a great many places in and around Edinburgh, the name comes from the Scottish Gaelic Inbhir Lìte elie , meaning "Mouth of Leith", such is the case with Inverness, meaning mouth of the River Ness etc. Some documents refer to the area as "Inner Leith".
The Royal Botanic Garden Edinburgh (RBGE) is a scientific centre for the study of plants, their diversity and conservation, as well as a popular tourist attraction. Originally founded in 1670 as a physic garden to grow medicinal plants, today it occupies four sites across Scotland — Edinburgh, Dawyck, Logan and Benmore — each with its own specialist collection. The RBGE's living collection consists of more than 13,302 plant species, (34,422 accessions) whilst the herbarium contains in excess of 3 million preserved specimens.
Edinburgh is a city in south east Scotland, situated on the southern shore of the Firth of Forth. It is the capital city of Scotland, a constituent country of the United Kingdom. With a population of 495,360 in 2011 (up 1.9% from 2010), it is the largest settlement in Lothian and lies at the centre of a larger urban zone of approximately 850,000 people.
Elie and Earlsferry is a town and former royal burgh in Fife, Scotland, situated within the East Neuk beside Chapel Ness on the north coast of the Firth of Forth, eight miles east of Leven. The burgh comprised the twin villages of Elie and Earlsferry, which were formally merged in 1930 by the Local Government Act of 1929. More photographs here...
I need to be looking into (in more detail):