Class pv.Layout.Partition
Extends
pv.Layout.Hierarchy.
Implemeents a hierarchical layout using the partition (or sunburst,
icicle) algorithm. This layout provides both node-link and space-filling
implementations of partition diagrams. In many ways it is similar to
pv.Layout.Cluster, except that leaf nodes are positioned based on
their distance from the root.
The partition layout support dynamic sizing for leaf nodes, if a #size psuedo-property is specified. The default size function returns 1, causing all leaf nodes to be sized equally, and all internal nodes to be sized by the number of leaf nodes they have as descendants.
The size function can be used in conjunction with the order property, which allows the nodes to the sorted by the computed size. Note: for sorting based on other data attributes, simply use the default null for the order property, and sort the nodes beforehand using the pv.Dom operator.
For more details on how to use this layout, see
pv.Layout.Hierarchy.
Defined in: Partition.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Constructs a new, empty partition layout.
|
Field Attributes | Field Name and Description |
---|---|
Default properties for partition layouts.
|
|
The inner radius; defaults to 0.
|
|
The sibling node order.
|
|
The orientation.
|
|
The outer radius; defaults to fill the containing panel, based on the height
and width of the layout.
|
- Fields borrowed from class pv.Layout.Network:
- label, link, node
- Fields borrowed from class pv.Panel:
- canvas, children, overflow, transform
- Fields borrowed from class pv.Bar:
- fillStyle, height, lineWidth, strokeStyle, width
- Fields borrowed from class pv.Mark:
- bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
Method Attributes | Method Name and Description |
---|---|
size(f)
Specifies the sizing function.
|
- Methods borrowed from class pv.Layout.Network:
- reset
- Methods borrowed from class pv.Panel:
- add, anchor
- Methods borrowed from class pv.Mark:
- anchorTarget, def, event, extend, margin, mouse, render
- See:
- pv.Dom.Node#sort
- left - left-to-right.
- right - right-to-left.
- top - top-to-bottom.
- bottom - bottom-to-top.
- radial - radially, with the root at the center.
For example, if the tree data structure represents a file system, with files as leaf nodes, and each file has a bytes attribute, you can specify a size function as:
.size(function(d) d.bytes)As with other properties, a size function may specify additional arguments to access the data associated with the layout and any enclosing panels.
- Parameters:
- {function} f
- the new sizing function.
- Returns:
- {pv.Layout.Partition} this.