jxxcarlson/elm-tree-builder/3.1.0

NOTE: the latest version is 7.0.0

Tree.Svg

Helper functions for rendering trees:

import Tree.Build
import Tree.Transform


-- Build the tree from text
tree =
    Tree.Build.fromString "?" identity "1\n 2\n 3\n 4\n"


-- Build the graph
graph =
    Result.map (Tree.Transform.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)
= NoLabel
| FullLabel
| FirstWord
render : LabelStyle -> Graph -> List (Svg msg)

Render a graph to SVG

transform : Float -> Float -> Float -> Float -> Float -> Graph -> Graph

Transform: shift by (dx, dy) and rescale by (sx,sy,sr)