When to Use
Use tree charts when you need to:- Display organizational hierarchies and reporting structures
- Visualize file system structures and directory trees
- Show decision trees and classification hierarchies
- Represent family trees and genealogical data
- Illustrate nested categories and taxonomies
Basic Configuration
A tree chart requires hierarchical data with a parent-child structure. Each node can have children, and the tree supports expand/collapse interactions.Complete Example
Here’s a comprehensive example showing an organizational hierarchy:Key Options
Layout Configuration
The layout type of the tree. From TreeSeries.ts:92, 268
'orthogonal': Traditional tree layout with straight branches'radial': Circular layout radiating from center
Orientation for orthogonal layout. From TreeSeries.ts:107, 287
'LR': Left to right'RL': Right to left'TB': Top to bottom'BT': Bottom to top'horizontal': Same as ‘LR’ (deprecated)'vertical': Same as ‘TB’ (deprecated)
Edge Configuration
Shape of the edge connecting nodes. From TreeSeries.ts:94, 271
'curve': Smooth curved lines'polyline': Straight line segments
Position where polyline edges fork. From TreeSeries.ts:99, 273Only effective when
edgeShape is ‘polyline’. Can be a percentage string or pixel value.Expand/Collapse
Whether to enable expand/collapse functionality. From TreeSeries.ts:109, 293When enabled, clicking on a node toggles its children’s visibility.
Initial expanded depth from root. From TreeSeries.ts:114, 295Nodes beyond this depth will be collapsed by default. Set to -1 to expand all.
Node Data
Hierarchical tree data. From TreeSeries.ts:66-77, 118
Leaves Styling
Special styling for leaf nodes (nodes without children). From TreeSeries.ts:82-84, 116Can contain
itemStyle, lineStyle, and label properties that override the default styles for leaf nodes.Line Style
Style of the edges connecting nodes. From TreeSeries.ts:55, 297-301
Interaction
Whether to enable zoom and pan. From TreeSeries.ts:276
Symbol size scale ratio during zoom. From TreeSeries.ts:101, 280
Emphasis
What to highlight on hover. From TreeSeries.ts:61
'self': Only the hovered node'ancestor': The node and all its ancestors'descendant': The node and all its descendants'relative': The node, ancestors, and descendants
Layout Box
Tree charts use box layout for positioning:Distance from the left edge.
Distance from the top edge.
Distance from the right edge.
Distance from the bottom edge.
Radial Layout
For radial layout, use these additional options:Best Practices
- Use
orient: 'LR'or'TB'based on your data width/depth ratio - Set
initialTreeDepthappropriately for large trees to avoid overwhelming users - Use
leavesstyling to differentiate leaf nodes from parent nodes - Enable
expandAndCollapsefor interactive exploration of large hierarchies - Use
edgeShape: 'polyline'for technical diagrams,'curve'for organic feel - Consider radial layout for balanced, symmetric trees
- Use
emphasis.focus: 'ancestor'or'descendant'to show hierarchical relationships on hover