Choreo.C4.Render.DOT (Choreo v0.9.0)

Copy Markdown View Source

DOT (Graphviz) rendering for Choreo.C4 architecture diagrams.

Produces C4-model-oriented visualisation:

  • Person — ellipse with thick border
  • Software System — rectangle with solid border
  • Container — rounded rectangle with solid border
  • Component — rectangle with dashed border

Relationships are rendered as directed edges with labels. Clusters group containers by their parent software system and components by their parent container.

Further reading

Summary

Functions

Renders a C4 model to a DOT string.

Functions

to_dot(c4, opts \\ [])

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

Renders a C4 model to a DOT string.

Options

  • :theme:default, :dark, :warm, :forest, :ocean, or a Choreo.Theme struct

Examples

iex> c4 = Choreo.C4.new()
iex> c4 = c4
...>   |> Choreo.C4.add_person(:user, label: "User")
...>   |> Choreo.C4.add_software_system(:app, label: "App")
...>   |> Choreo.C4.add_relationship(:user, :app, label: "Uses")
iex> dot = Choreo.C4.Render.DOT.to_dot(c4)
iex> String.contains?(dot, "digraph")
true
iex> String.contains?(dot, "User")
true
iex> String.contains?(dot, "App")
true