Class Index | File Index

Classes


Class pv.Layout.Pack


Extends pv.Layout.Hierarchy.
Implements a hierarchical layout using circle-packing. The meaning of the exported mark prototypes changes slightly in the space-filling implementation:

The pack 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: Pack.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Constructs a new, empty circle-packing layout.
Field Summary
Field Attributes Field Name and Description
 
Default properties for circle-packing layouts.
 
The sibling node order.
 
The spacing parameter; defaults to 1, which provides a little bit of padding between sibling nodes and the enclosing circle.
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 Summary
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
Class Detail
pv.Layout.Pack()
Constructs a new, empty circle-packing layout. Layouts are not typically constructed directly; instead, they are added to an existing panel via pv.Mark#add.
See:
"Visualization of large hierarchical data by circle packing" by W. Wang, H. Wang, G. Dai, and H. Wang, ACM CHI 2006.
Field Detail
{pv.Layout.Pack} defaults
Default properties for circle-packing layouts. The default spacing parameter is 1 and the default order is "ascending".

{string} order
The sibling node order. The default order is null, which means to use the sibling order specified by the nodes property as-is. A value of "ascending" will sort siblings in ascending order of size, while "descending" will do the reverse. For sorting based on data attributes other than size, use the default null for the order property, and sort the nodes beforehand using the pv.Dom operator.
See:
pv.Dom.Node#sort

{number} spacing
The spacing parameter; defaults to 1, which provides a little bit of padding between sibling nodes and the enclosing circle. Larger values increase the spacing, by making the sibling nodes smaller; a value of zero makes the leaf nodes as large as possible, with no padding on enclosing circles.
Method Detail
{pv.Layout.Pack} size(f)
Specifies the sizing function. By default, a sizing function is disabled and all nodes are given constant size. The sizing function is invoked for each leaf node in the tree (passed to the constructor).

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.Pack} this.

Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT)