Mermaid.js rendering for Choreo.DecisionTree.
Produces tree-oriented visualisation:
- Root — rhombus with thick stroke
- Decisions — rhombus shapes
- Outcomes — rounded rectangles with class colour coding
Layout is top-down so decisions flow downward to outcomes. Edge labels show the branch condition.
Themes
:default— purple root, blue decisions, green outcomes:dark— dark background, neon accentsChoreo.Themestruct — full custom control
Summary
Functions
Returns a theme for Choreo.DecisionTree Mermaid diagrams.
Renders a decision tree to a Mermaid flowchart string.
Functions
@spec theme( atom(), keyword() ) :: Choreo.Theme.t()
Returns a theme for Choreo.DecisionTree Mermaid diagrams.
@spec to_mermaid( Choreo.DecisionTree.t(), keyword() ) :: String.t()
Renders a decision tree to a Mermaid flowchart string.
Options
:theme—:default,:dark,:warm,:forest,:ocean, or aChoreo.Themestruct:direction—:td(default),:lr,:bt,:rl:highlighted_nodes— list of node IDs to highlight:highlighted_edges— list of{from, to}tuples to highlight- Any other option accepted by
Yog.Multi.Mermaid.to_mermaid/2
Examples
iex> tree = Choreo.DecisionTree.new()
iex> tree = tree
...> |> Choreo.DecisionTree.set_root(:color, feature: "color")
...> |> Choreo.DecisionTree.add_outcome(:stop, label: "Stop")
...> |> Choreo.DecisionTree.add_outcome(:go, label: "Go")
...> |> Choreo.DecisionTree.branch(:color, :stop, "red")
...> |> Choreo.DecisionTree.branch(:color, :go, "green")
iex> mermaid = Choreo.DecisionTree.Render.Mermaid.to_mermaid(tree)
iex> String.contains?(mermaid, "graph TD")
true
iex> String.contains?(mermaid, "red")
true
iex> String.contains?(mermaid, "green")
true