Choreo.FSM.Render.DOT (Choreo v0.14.0)

Copy Markdown View Source

DOT (Graphviz) rendering for Choreo.FSM state-machine diagrams.

Produces classic state-machine visualisation:

  • Normal states — filled circles
  • Initial states — filled circles with a black entry-point dot
  • Final states — double circles
  • Transitions — labeled arrows
  • Layout is left-to-right by default

Themes

  • :default — light grey states, dark text, left-to-right
  • :dark — dark background, neon accents
  • :minimal, :warm, :forest, :ocean — additional built-in palettes
  • Choreo.Theme struct — full custom control

Summary

Functions

Renders an FSM to a DOT string.

Functions

to_dot(fsm, opts \\ [])

@spec to_dot(Choreo.FSM.t(), keyword()) :: String.t()

Renders an FSM to a DOT string.

Options

  • :theme:default, :dark, :minimal, :warm, :forest, :ocean, or a Choreo.Theme struct
  • :highlighted_nodes — list of state IDs to highlight
  • :highlighted_edges — list of edge IDs or {from, to} tuples to highlight
  • Any other option accepted by Yog.Multi.DOT.to_dot/2, such as :rankdir

Examples

iex> fsm = Choreo.FSM.new() |> Choreo.FSM.add_state(:a)
iex> dot = Choreo.FSM.Render.DOT.to_dot(fsm)
iex> String.contains?(dot, "digraph")
true
iex> String.contains?(dot, "rankdir=LR")
true
iex> String.contains?(dot, "a")
true