FlowchartDiagram Class

A flowchart: nodes of various shapes linked by edges, grouped in subgraphs, laid out in ranks in the direction of the flow (Mermaid flowchart).

public sealed class FlowchartDiagram : Diagram
Inheritance
Diagram FlowchartDiagram

Constructors

NameDescription
FlowchartDiagram()

FlowchartDiagram()

FlowchartDiagram.cs
public FlowchartDiagram()

No documentation is available.

Properties

NameDescription
ClassDefinitionsGets the styles of the classes of the nodes, subgraphs and edges, by name (Mermaid classDef). The class default applies to every node.
CurveGets or sets the curve of the edges. The default is EdgeCurve.Basis.
DefaultEdgeStyleGets or sets the style of every edge, which the style of an edge takes precedence over (Mermaid linkStyle default).
DirectionGets or sets the direction of the flow. The default is DiagramDirection.TopToBottom.
EdgesGets the edges, drawn in order.
NodeSpacingGets or sets the space between two nodes of a rank, in pixels. The default is 50.
NodesGets the nodes. The nodes of the subgraphs that are not in this list are drawn too.
RankSpacingGets or sets the space between two ranks, in pixels. The default is 50.
SubgraphsGets the top-level subgraphs.
SwimlanesGets or sets a value that indicates whether the top-level subgraphs are drawn as swimlanes: bands across the diagram, in their order, that hold their nodes (Mermaid swimlane-beta). The nested subgraphs are boxes in their lane.
WrappingWidthGets or sets the width at which the labels wrap, in pixels, or null to wrap them only at their line feeds. The default is 200.

ClassDefinitions

FlowchartDiagram.cs

Gets the styles of the classes of the nodes, subgraphs and edges, by name (Mermaid classDef). The class default applies to every node.

public IDictionary<string, DiagramStyle> ClassDefinitions { get; }

Gets or sets the curve of the edges. The default is EdgeCurve.Basis.

public EdgeCurve Curve { get; set; }

Property value

EdgeCurve

DefaultEdgeStyle

FlowchartDiagram.cs

Gets or sets the style of every edge, which the style of an edge takes precedence over (Mermaid linkStyle default).

public DiagramStyle? DefaultEdgeStyle { get; set; }

Property value

DiagramStyle?

Gets or sets the direction of the flow. The default is DiagramDirection.TopToBottom.

public DiagramDirection Direction { get; set; }

Property value

DiagramDirection

Gets the edges, drawn in order.

public IList<FlowchartEdge> Edges { get; }

Property value

IList<FlowchartEdge>

Gets or sets the space between two nodes of a rank, in pixels. The default is 50.

public double NodeSpacing { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is negative or not finite.

Gets the nodes. The nodes of the subgraphs that are not in this list are drawn too.

public IList<FlowchartNode> Nodes { get; }

Property value

IList<FlowchartNode>

Gets or sets the space between two ranks, in pixels. The default is 50.

public double RankSpacing { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is negative or not finite.

Gets the top-level subgraphs.

public IList<FlowchartSubgraph> Subgraphs { get; }

Gets or sets a value that indicates whether the top-level subgraphs are drawn as swimlanes: bands across the diagram, in their order, that hold their nodes (Mermaid swimlane-beta). The nested subgraphs are boxes in their lane.

public bool Swimlanes { get; set; }

Property value

bool

WrappingWidth

FlowchartDiagram.cs

Gets or sets the width at which the labels wrap, in pixels, or null to wrap them only at their line feeds. The default is 200.

public double? WrappingWidth { get; set; }

Property value

double?

Exceptions

ArgumentOutOfRangeException
The value is not a positive finite number.

Methods

NameDescription
AddEdge(FlowchartElement, FlowchartElement, DiagramText?)Adds an edge.
AddEdge(string, string, DiagramText?)Adds an edge between two elements found by identifier; a missing node is added.
AddNode(string, DiagramText?, FlowchartNodeShape)Adds a node.
AddSubgraph(string, DiagramText?)Adds a top-level subgraph.
EnumerateSubgraphs()Enumerates the subgraphs and their nested subgraphs, depth first.
Find(string)Finds a node or a subgraph by identifier.

AddEdge overloads

AddEdge(FlowchartElement, FlowchartElement, DiagramText?)

FlowchartDiagram.cs

Adds an edge.

public FlowchartEdge AddEdge(FlowchartElement source, FlowchartElement target, DiagramText? label = null)
Parameters
source FlowchartElement
The element the edge starts from.
target FlowchartElement
The element the edge goes to.
label DiagramText?
The text of the edge, or null for none.
Returns

FlowchartEdge The edge.

AddEdge(string, string, DiagramText?)

FlowchartDiagram.cs

Adds an edge between two elements found by identifier; a missing node is added.

public FlowchartEdge AddEdge(string sourceId, string targetId, DiagramText? label = null)
Parameters
sourceId string
The identifier of the element the edge starts from.
targetId string
The identifier of the element the edge goes to.
label DiagramText?
The text of the edge, or null for none.
Returns

FlowchartEdge The edge.

AddNode(string, DiagramText?, FlowchartNodeShape)

FlowchartDiagram.cs

Adds a node.

public FlowchartNode AddNode(string id, DiagramText? label = null, FlowchartNodeShape shape = FlowchartNodeShape.Rectangle)

Parameters

id string
The identifier of the node, unique in the flowchart.
label DiagramText?
The text of the node, or null to show its identifier.
shape FlowchartNodeShape
The shape of the node.

Returns

FlowchartNode The node.

AddSubgraph(string, DiagramText?)

FlowchartDiagram.cs

Adds a top-level subgraph.

public FlowchartSubgraph AddSubgraph(string id, DiagramText? title = null)

Parameters

id string
The identifier of the subgraph, unique in the flowchart.
title DiagramText?
The title, or null to show the identifier.

Returns

FlowchartSubgraph The subgraph.

EnumerateSubgraphs()

FlowchartDiagram.cs

Enumerates the subgraphs and their nested subgraphs, depth first.

public IEnumerable<FlowchartSubgraph> EnumerateSubgraphs()

Returns

IEnumerable<FlowchartSubgraph> The subgraphs.

Finds a node or a subgraph by identifier.

public FlowchartElement? Find(string id)

Parameters

id string
The identifier.

Returns

FlowchartElement? The element, or null when there is none.