Overview
ThePack class builds a circle packing diagram where hierarchical data is displayed using nested circles. The size of each circle represents its value.
Class Hierarchy
- Series
- Hierarchy
- Pack
- Hierarchy
Settings
nodePadding
Gap between nodes in pixels.Since: 5.2.6
Inherited Settings
Pack inherits all settings from Hierarchy, including:sort- How to sort nodes by value (“ascending” | “descending” | “none”)valueField- Field in data holding numeric valuecategoryField- Field in data holding category namechildDataField- Field in data holding array of childrendownDepth- Number of child levels to show when drilling downupDepth- Number of parent levels to show from selected nodeinitialDepth- Number of levels to show on first loadtopDepth- Starting level to show (hides upper levels)singleBranchOnly- Collapse other branches when one expandsanimationDuration- Duration for drill animations in millisecondsanimationEasing- Easing function for animationscolors- ColorSet for auto-assigning node colorspatterns- PatternSet for auto-assigning node patterns
Data Item Properties
Each data item in a Pack chart has the following properties:children
An array of data items of node’s children.
parent
A data item of node’s parent.
circle
A Circle element of the node.
value
Value of the node as set in data.
sum
Sum of child values.
valuePercentTotal
Percent value of the node, based on total sum of all nodes in upper level.
valuePercent
Percent value of the node, based on the value of its direct parent.Since: 5.2.21
category
Category name of the node.
depth
Node’s depth within the hierarchy (0 for root).
node
Reference to the visual HierarchyNode element.
label
Reference to node’s Label element.
fill
Node’s auto-assigned color.
fillPattern
Node’s auto-assigned pattern.Since: 5.10.0
disabled
Indicates if node is currently disabled (collapsed).
Data Format
Example Data
List Templates
Pack provides access to these list templates for customization:nodes
List of all node container elements.
circles
List of node circle elements in the Pack chart.
labels
List of label elements.
Containers
nodesContainer
Container that holds all node elements.
Methods
selectDataItem()
The data item to select.
getDataItemById()
The ID to search for.
The found data item, or undefined if not found.
enableDataItem()
Target data item to enable.
Maximum depth to enable children to.
Current depth (used internally for recursion).
Animation duration in milliseconds.
disableDataItem()
Target data item to disable.
Animation duration in milliseconds.
addChildData()
Parent data item to add children to.
Array of child data objects.
hoverDataItem()
Target data item.
unhoverDataItem()
Target data item.
Events
dataitemselected
The selected data item.
Private Settings
These are read-only private settings managed internally:scaleR
Current radius scale factor.