StateDiagram Class
A state diagram: states, linked by transitions, with start and end states, choices, forks and joins, and composite states that hold other states, in concurrent regions or not (Mermaid stateDiagram-v2).
public sealed class StateDiagram : Diagram- Inheritance
DiagramStateDiagram
Constructors
| Name | Description |
|---|---|
| StateDiagram() |
StateDiagram()
StateDiagram.cspublic StateDiagram()No documentation is available.
Properties
| Name | Description |
|---|---|
| ClassDefinitions | Gets the styles of the CSS classes of the states, by name (Mermaid classDef). The class default applies to every state. |
| Direction | Gets or sets the direction of the transitions. The default is DiagramDirection.TopToBottom. |
| Notes | Gets the notes. |
| States | Gets the top-level states. |
| Transitions | Gets the transitions, drawn in order. |
ClassDefinitions
StateDiagram.csGets the styles of the CSS classes of the states, by name (Mermaid classDef). The class default applies to every state.
public IDictionary<string, DiagramStyle> ClassDefinitions { get; }Property value
Direction
StateDiagram.csGets or sets the direction of the transitions. The default is DiagramDirection.TopToBottom.
public DiagramDirection Direction { get; set; }Property value
Notes
StateDiagram.csStates
StateDiagram.csTransitions
StateDiagram.csGets the transitions, drawn in order.
public IList<StateTransition> Transitions { get; }Property value
Methods
| Name | Description |
|---|---|
| AddNote(StateDiagramState, DiagramText, StateNotePosition) | Adds a note next to a state. |
| AddState(string, DiagramText?, StateKind) | Adds a top-level state. |
| AddTransition(StateDiagramState, StateDiagramState, DiagramText?) | Adds a transition. |
| EnumerateStates() | Enumerates the states and the states of their regions, depth first. |
| Find(string) | Finds a state by identifier, in the diagram and its composite states. |
AddNote(StateDiagramState, DiagramText, StateNotePosition)
StateDiagram.csAdds a note next to a state.
public StateNote AddNote(StateDiagramState state, DiagramText text, StateNotePosition position = StateNotePosition.Right)Parameters
stateStateDiagramState- The state.
textDiagramText- The text of the note.
positionStateNotePosition- The side of the state.
Returns
StateNote The note.
AddState(string, DiagramText?, StateKind)
StateDiagram.csAdds a top-level state.
public StateDiagramState AddState(string id, DiagramText? label = null, StateKind kind = StateKind.Normal)Parameters
idstring- The identifier of the state, unique in the diagram.
labelDiagramText?- The name shown, or
nullto show the identifier. kindStateKind- The kind of the state.
Returns
StateDiagramState The state.
AddTransition(StateDiagramState, StateDiagramState, DiagramText?)
StateDiagram.csAdds a transition.
public StateTransition AddTransition(StateDiagramState from, StateDiagramState to, DiagramText? label = null)Parameters
fromStateDiagramState- The state the transition leaves.
toStateDiagramState- The state the transition enters.
labelDiagramText?- The text of the transition, or
nullfor none.
Returns
StateTransition The transition.
EnumerateStates()
StateDiagram.csEnumerates the states and the states of their regions, depth first.
public IEnumerable<StateDiagramState> EnumerateStates()Returns
IEnumerable<StateDiagramState> The states.
Find(string)
StateDiagram.csFinds a state by identifier, in the diagram and its composite states.
public StateDiagramState? Find(string id)