Skip to content
commit-766c8d6756a1

Interactive tree

Parent-child relationships for following paths, ancestry, taxonomy, and progressive disclosure.

Purpose
Explore ownership, taxonomy, ancestry, and other parent-child structures.
Use when
Paths and progressive disclosure are more useful than size comparison.
Avoid when
The hierarchy is very deep or exact values must be compared.
Equivalent data
Preserve node names, values, and parent-child paths in adjacent text or a table.
Usage Example
@interactivetree.Tree(interactivetree.Config{
  Label: "Basic tree example",
  Caption: "One root with three branches; Node3 starts collapsed.",
  Roots: []*interactivetree.Node{{
    Name: "Root",
    Children: []*interactivetree.Node{
      {Name: "Node1", Children: []*interactivetree.Node{{Name: "Child1"}}},
      {Name: "Node2", Children: []*interactivetree.Node{
        {Name: "Child1"}, {Name: "Child2"}, {Name: "Child3"},
      }},
      {Name: "Node3", Collapsed: chart.Bool(true), Children: []*interactivetree.Node{
        {Name: "Child1"}, {Name: "Child2"}, {Name: "Child3"},
      }},
    },
  }},
  Orientation: interactivetree.OrientationLeftToRight,
  InitialDepth: chart.Int(-1),
  NodeLabel: &chart.LabelOptions{Show: chart.Bool(true), Position: "top"},
  LeafLabel: &chart.LabelOptions{Show: chart.Bool(true), Position: "right"},
  Insets: interactivetree.Insets{Left: "14%", Right: "14%", Top: "12%", Bottom: "12%"},
  Width: "100%",
  Height: "440px",
})

Reading the tree

Layered and radial views change layout. Keep an adjacent nested list or table as the exact-data source.

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/tree

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