Helper functions for rendering trees:
import Tree.Build
import Tree.Render
-- Build the tree from text
tree =
Tree.Build.fromString "?" .content "1\n 2\n 3\n 4\n"
-- Build the graph
graph =
Result.map (Tree.Render.toGraph preferences identity)
tree |> Result.withDefault []
-- Render the graph. The first argument is the label style.
Tree.Svg.render NoLabel (Tree.Svg.transform 280 100 60 60 0.5 graph)
render : LabelStyle -> Tree.Graph.Graph -> List (Svg msg)
Render a graph to SVG
transform : Basics.Float -> Basics.Float -> Basics.Float -> Basics.Float -> Basics.Float -> Tree.Graph.Graph -> Tree.Graph.Graph
Transform: shift by dx, dy and rescale by sx,sy,sr where the arguments are dx, dy, sx, sy, sr, graph