RadialCluster

Circular dendrogram for hierarchical data visualization

Native Implementation Zero Dependencies

Key Features

🌳

Hierarchical Layout

Cluster algorithm positions leaf nodes at equal depth from center

πŸ”—

Radial Links

Curved BΓ©zier paths connect parent and child nodes naturally

🏷️

Rotated Labels

Text labels rotate to follow radial direction for readability

πŸ’¬

Interactive Tooltips

Hover over nodes to see details, depth, and child count

🎨

Customisable

Full control over colours, sizes, fonts, and styling

πŸ“¦

Copy-Paste Ready

Self-contained component with no external charting library required

Full Dataset Example

The classic D3 "flare" dataset showing a software package hierarchy. This demonstrates the component's ability to handle complex, deeply nested data structures with many nodes.

<script>
  import RadialCluster from '$lib/components/RadialCluster.svelte';
  import { FALLBACK_RADIAL_CLUSTER_DATA } from '$lib/constants';
</script>

<RadialCluster
  data={FALLBACK_RADIAL_CLUSTER_DATA}
  width={900}
  height={900}
/>

Simple Data Structure

A smaller dataset to demonstrate the basic structure. Perfect for category trees, organisation charts, or any simple hierarchy.

const data = {
  name: 'root',
  children: [
    {
      name: 'Category A',
      children: [
        { name: 'Item A1' },
        { name: 'Item A2' },
        { name: 'Item A3' }
      ]
    },
    // ... more categories
  ]
};

<RadialCluster
  data={data}
  width={600}
  height={600}
  fontSize={12}
  nodeRadius={4}
/>

Colour Schemes

Customise the colour palette to match your application's theme. Control node colours, link colours, and opacity independently.

<RadialCluster
  data={data}
  nodeColorParent="#555"
  nodeColorLeaf="#999"
  linkColor="#555"
/>

Label Configuration

Control how labels are displayed - toggle visibility, rotation, and styling.

<RadialCluster
  data={data}
  showLabels={true}
  rotateLabels={true}
/>

Props Reference

PropTypeDefaultDescription
dataRadialClusterNoderequiredHierarchical data with name and optional children array
widthnumber800Container width in pixels
heightnumber800Container height in pixels
innerRadiusnumber100Radius where root node starts
outerRadiusnumberautoRadius where leaf nodes end (calculated from size if not set)
nodeRadiusnumber2.5Radius of node circles in pixels
nodeColorParentstring'#555'Colour for parent nodes (with children)
nodeColorLeafstring'#999'Colour for leaf nodes (no children)
linkColorstring'#555'Colour for connecting lines
linkOpacitynumber0.4Opacity of connecting lines (0-1)
linkWidthnumber1.5Width of connecting lines in pixels
fontSizenumber11Font size for labels in pixels
fontFamilystring'system-ui, sans-serif'Font family for labels
labelColorstring'#333'Colour for text labels
showLabelsbooleantrueWhether to display node labels
rotateLabelsbooleantrueRotate labels to follow radial direction
separationnumber1Separation factor between sibling nodes
classstring''Additional CSS classes for container

Data Structure

The component expects hierarchical data where each node has a name and optional children array. The value property is optional and can be used for additional data.

interface RadialClusterNode {
  name: string;           // Display label for the node
  children?: RadialClusterNode[];  // Optional child nodes
  value?: number;         // Optional numeric value
}

// Example:
const data: RadialClusterNode = {
  name: 'root',
  children: [
    {
      name: 'Branch A',
      children: [
        { name: 'Leaf 1', value: 100 },
        { name: 'Leaf 2', value: 200 }
      ]
    },
    {
      name: 'Branch B',
      children: [
        { name: 'Leaf 3', value: 150 }
      ]
    }
  ]
};

Use Cases

πŸ“ File Systems

Visualise directory structures and file hierarchies in a compact circular layout

🏒 Organisational Charts

Display company structures, team hierarchies, and reporting relationships

🧬 Taxonomies

Show biological classifications, category trees, or knowledge taxonomies

πŸ“¦ Package Dependencies

Visualise software module structures and dependency trees

🌿 Evolutionary Trees

Display phylogenetic trees and evolutionary relationships

πŸ—‚οΈ Document Structures

Show book chapters, section hierarchies, or content outlines

Implementation Details

Native Algorithm

Custom cluster layout algorithm positions nodes without D3. Leaf nodes are placed at equal radius, internal nodes at the mean angle of descendants.

SVG Rendering

Pure SVG output with viewBox scaling for responsive display. No canvas or WebGL dependencies.

Radial Links

Cubic BΓ©zier curves connect nodes along radial paths, creating natural-looking connections between hierarchy levels.

Accessibility

ARIA labels, keyboard navigation, and focus management for screen reader compatibility.