Skip to content
commit-766c8d6756a1

Interactive sunburst

Weighted parent-child hierarchy shown as concentric sectors and nested branches.

Purpose
Explore a weighted hierarchy as concentric radial sectors.
Use when
A compact overview of a shallow hierarchy and its branch proportions is useful.
Avoid when
Deep hierarchies, close comparisons, or a clear reading order matter; use a tree or table.
Equivalent data
Use the adjacent path-and-value table to inspect the same hierarchy with keyboard navigation and without relying on the radial graphic.
Exact hierarchy and values
PathParentValue
parent-00.81
parent-0 / child-0parent-00.34
parent-10.62
parent-1 / child-1parent-10.57
parent-20.45
parent-2 / child-2parent-20.73
parent-30.93
parent-3 / child-3parent-30.28
parent-40.38
parent-4 / child-4parent-40.66
parent-50.71
parent-5 / child-5parent-50.49
parent-60.54
parent-6 / child-6parent-60.87
Usage Example
@interactivesunburst.Sunburst(interactivesunburst.Config{
  Label: "Basic sunburst example",
  Caption: "Seven parent nodes, each paired with one child.",
  Nodes: []*interactivesunburst.Node{
    {Name: "parent-0", Value: 0.81, Children: []*interactivesunburst.Node{
      {Name: "child-0", Value: 0.34},
    }},
	{Name: "parent-1", Value: 0.62, Children: []*interactivesunburst.Node{{Name: "child-1", Value: 0.57}}},
	{Name: "parent-2", Value: 0.45, Children: []*interactivesunburst.Node{{Name: "child-2", Value: 0.73}}},
	{Name: "parent-3", Value: 0.93, Children: []*interactivesunburst.Node{{Name: "child-3", Value: 0.28}}},
	{Name: "parent-4", Value: 0.38, Children: []*interactivesunburst.Node{{Name: "child-4", Value: 0.66}}},
	{Name: "parent-5", Value: 0.71, Children: []*interactivesunburst.Node{{Name: "child-5", Value: 0.49}}},
    {Name: "parent-6", Value: 0.54, Children: []*interactivesunburst.Node{
      {Name: "child-6", Value: 0.87},
    }},
  },
  Navigation: interactivesunburst.NavigationDrillDown,
  Sort: interactivesunburst.SortDescending,
  LabelOptions: &chart.LabelOptions{Show: chart.Bool(true), Position: "inside", FontSize: 10},
  InnerRadius: 16,
  OuterRadius: 88,
  Width: "100%",
  Height: "32rem",
  Style: charttheme.Style{Class: "max-w-full"},
  RootAttrs: templ.Attributes{"data-chart-purpose": "hierarchy"},
})

Explore the hierarchy

Visual drill-down can focus a branch, but it is not the accessible navigation path. Use the keyboard-accessible adjacent table to inspect every parent-child path and value.

Go API

v0.0.1

The examples above cover behavior and composition. pkg.go.dev is the canonical reference for exported types, functions, methods, and Go documentation.

github.com/araihu/goshtoso-charts/components/interactive/sunburst

Enabled, disabled, hidden, and omitted wrapper behavior, controls, export, and client transitions are shared by every chart. Review chart controls, then compare static/vector and interactive capabilities.

Open v0.0.1 API