I am trying to develop a hierarchical tree view in which the weight of each node is equal to the actual number of child nodes. The leaf unit has a weight of 1.
I want to arrange these elements so that they can be viewed, going deeper into the tree, showing the root categories (without parents) at the beginning. Clicking on a node causes the view to redraw itself to show only the descendants of that node.
The difficulty is that the size in pixels of a node must be proportional to its weight compared to neighboring nodes. According to Wikipedia, this is called a tree map, and I need a sheet algorithm that I tried to understand myself, but it seems more complex than I expected.
As an example, here's a Mac Os X program called GrandPerspective, which shows the folder sizes of your HD :

(source: arstechnica.com )
I want to arrange the nodes this way! (the size is of course proportional to the size of the folder)
Any suggestions?
thank
source
share