D3 Tutorial
Hierarchical Layouts
Edit by Jiayi Xu and Han-Wei Shen, The Ohio State University
D3 Tutorial Hierarchical Layouts Edit by Jiayi Xu and Han-Wei Shen, - - PowerPoint PPT Presentation
D3 Tutorial Hierarchical Layouts Edit by Jiayi Xu and Han-Wei Shen, The Ohio State University Hierarchical Layouts D3 has a number of hierarchical layouts to help with visualizing hierarchies or trees Well look at the tree , cluster ,
Hierarchical Layouts
Edit by Jiayi Xu and Han-Wei Shen, The Ohio State University
hierarchies or trees
nodes have an associated numeric value (e.g. population, revenue etc.).
by d3.hierarchy(data, children) function
information of children
data
new nested hierarchical structure to store
and height of this node in this tree structure
arrangement
the tree
nodes
nodes, starting with this node, then followed by each child in topological order
nodes by computed x and y attributes
this node (and its descendants), where each link is an object that defines source and target properties.
parent node, and the target is a child node.
the tree layout
nodes are placed at the same depth.
d3.tree() to d3.cluster()
represent hierarchies where each item has an associated value
country population data as a hierarchy
region
each country.
each country as a rectangle (sized proportionally to the population) and group each region together
population or revenue)
100 300 200 200
automatically
100 300 200 200 600 800
padding/gaps between rectangles
top-left corner (x0, y0) and bottom- right corner (x1, y1) of rectangles
attached to corresponding nodes
aspect ratio by default
Golden ratio d3.treemapDice d3.treemapSlice
treemap layout
used to represent nodes.
treemap
quantities due to wasted space
100 300 200 200 600 800
circles
radius r of circles
corresponding nodes
radius r of circles
tree diagram.
100 300 200 200 600 800
rectangles
coordinates of top-left corner (x0, y0) and bottom-right corner (x1, y1) of rectangles
corresponding nodes
rectangles by
coordinates [angle (in radians), radius]
corners of B1 (x0, y0) (x1, y1)
radians) of an arc
an arc