Boxart.Render.Mindmap (Boxart v0.3.2)

Copy Markdown View Source

Renderer for mindmap diagrams.

Accepts a Graph.t() from libgraph and renders it as a tree radiating from a central root node. Children branch to the right by default. When the root has many children (>6), the first few overflow to the left.

Vertex labels are used as node text. The root is detected automatically (the vertex with no incoming edges).

Example

graph =
  Graph.new()
  |> Graph.add_vertex("Root")
  |> Graph.add_vertex("Design")
  |> Graph.add_vertex("Code")
  |> Graph.add_vertex("Test")
  |> Graph.add_edge("Root", "Design")
  |> Graph.add_edge("Root", "Code")
  |> Graph.add_edge("Root", "Test")

Boxart.Render.Mindmap.render(graph)

Summary

Functions

ljust(str, width)

See Boxart.Utils.ljust/2.

render(input, opts \\ [])

@spec render(
  Graph.t() | Boxart.Render.Mindmap.MindmapNode.t() | nil,
  keyword()
) :: String.t()

Renders a mindmap tree to a string.

Options

  • :charset:unicode (default) or :ascii
  • :rounded — use rounded corners (default: true, only with :unicode)

rjust(str, width)

See Boxart.Utils.rjust/2.