Overview
TheSunburst class builds a sunburst diagram where hierarchical data is displayed using nested circular sectors (slices). Each level of hierarchy is represented by a ring, with the root at the center.
Class Hierarchy
- Series
- Hierarchy
- Partition
- Sunburst
- Partition
- Hierarchy
Settings
startAngle
Start angle of the series in degrees.
- 0° is at 3 o’clock
- -90° is at 12 o’clock (default)
- 90° is at 6 o’clock
- 180° is at 9 o’clock
endAngle
End angle of the series in degrees.Default is 270° which, combined with startAngle of -90°, creates a full circle.
innerRadius
Inner radius of the sunburst pie.
- Can be a fixed pixel value or percent
- Setting to negative number will mean pixels from outer radius
- Default of 0 means center starts at middle
radius
Outer radius of the sunburst pie.Can be a fixed pixel value or percent relative to available space.
nodePadding
Padding between slices in pixels.
Inherited Settings
Sunburst inherits all settings from Partition and 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 Sunburst chart has the following properties:children
Data items of child nodes.
parent
Data item of a parent node.
slice
A Slice 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 RadialLabel 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
Sunburst provides access to these list templates for customization:nodes
List of all node container elements.
slices
List of node slice elements in the Sunburst chart.
labels
List of radial label elements.RadialLabel can be rendered as radial or circular text.
Containers
nodesContainer
Container that holds all node elements.For Sunburst, this is centered at 50% x 50% of the chart area.
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:dr
Current radial offset for zoom animation.
dx
Current angular offset for zoom animation.
innerRadius
Calculated inner radius in pixels.
hierarchySize
Total radial size available for hierarchy levels.