Documentation
¶
Overview ¶
Package flowchart provides functionality for creating Mermaid flowcharts
Index ¶
- Constants
- type Class
- type Flowchart
- func (f *Flowchart) AddClass(name string) (newClass *Class)
- func (f *Flowchart) AddLink(from *Node, to *Node) (newLink *Link)
- func (f *Flowchart) AddNode(text string) (newNode *Node)
- func (f *Flowchart) AddSubgraph(title string) (newSubgraph *Subgraph)
- func (f *Flowchart) RenderToFile(path string) error
- func (f *Flowchart) SetDirection(direction flowchartDirection) *Flowchart
- func (f *Flowchart) String() string
- type FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetArrowMarkerAbsolute(v bool) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetCurve(v string) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetDefaultRenderer(v string) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetDiagramPadding(v int) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetHtmlLabels(v bool) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetNodeSpacing(v int) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetPadding(v int) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetRankSpacing(v int) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetTitleTopMargin(v int) *FlowchartConfigurationProperties
- func (c *FlowchartConfigurationProperties) SetWrappingWidth(v int) *FlowchartConfigurationProperties
- func (c FlowchartConfigurationProperties) String() string
- type Link
- type Node
- type NodeStyle
- type Subgraph
Constants ¶
const ( FlowchartDirectionTopToBottom flowchartDirection = "TB" FlowchartDirectionTopDown flowchartDirection = "TD" FlowchartDirectionBottomUp flowchartDirection = "BT" FlowchartDirectionRightLeft flowchartDirection = "RL" FlowchartDirectionLeftRight flowchartDirection = "LR" )
List of possible Flowchart directions. Reference: https://mermaid.js.org/syntax/flowchart.html#direction
const ( CurveStyleNone curveStyle = "" CurveStyleBasis curveStyle = "basis" CurveStyleBumpX curveStyle = "bumpX" CurveStyleBumpY curveStyle = "bumpY" CurveStyleCardinal curveStyle = "cardinal" CurveStyleCatmullRom curveStyle = "catmullRom" CurveStyleLinear curveStyle = "linear" CurveStyleMonotoneX curveStyle = "monotoneX" CurveStyleMonotoneY curveStyle = "monotoneY" CurveStyleNatural curveStyle = "natural" CurveStyleStep curveStyle = "step" CurveStyleStepAfter curveStyle = "stepAfter" CurveStyleStepBefore curveStyle = "stepBefore" )
List of possible Flowchart directions. Reference: https://mermaid.js.org/syntax/flowchart.html#styling-line-curves
const ( LinkShapeOpen linkShape = "--%s" LinkShapeDotted linkShape = "-.%s-" LinkShapeThick linkShape = "==%s" LinkShapeInvisible linkShape = "~~%s" )
List of possible Link shapes. Reference: https://mermaid.js.org/syntax/flowchart.html#links-between-nodes
const ( LinkArrowTypeNone linkArrowType = "" LinkArrowTypeArrow linkArrowType = ">" LinkArrowTypeLeftArrow linkArrowType = "<" LinkArrowTypeBullet linkArrowType = "o" LinkArrowTypeCross linkArrowType = "x" )
List of possible Link arrow types. Reference: https://mermaid.js.org/syntax/flowchart.html#links-between-nodes
const ( // Basic shapes NodeShapeProcess nodeShape = `rect` // Process (Rectangle) NodeShapeEvent nodeShape = `rounded` // Event (Rounded rectangle) NodeShapeTerminal nodeShape = `stadium` // Terminal (Stadium-shaped) NodeShapeSubprocess nodeShape = `fr-rect` // Subprocess (Framed rectangle) NodeShapeDatabase nodeShape = `cyl` // Database (Cylinder) NodeShapeStart nodeShape = `circle` // Start (Circle) NodeShapeOdd nodeShape = `odd` // Odd shape (Asymmetric) NodeShapeDecision nodeShape = `diam` // Decision (Diamond) NodeShapePrepare nodeShape = `hex` // Prepare (Hexagon) NodeShapeInputOutput nodeShape = `lean-r` // Input/Output (Parallelogram) NodeShapeOutputInput nodeShape = `lean-l` // Output/Input (Alt Parallelogram) NodeShapeManualOperation nodeShape = `trap-b` // Manual Operation (Trapezoid) NodeShapeManual nodeShape = `trap-t` // Manual (Alt Trapezoid) NodeShapeStopDouble nodeShape = `dbl-circ` // Stop (Double Circle) NodeShapeText nodeShape = `text` // Text block NodeShapeCard nodeShape = `notch-rect` // Card NodeShapeLinedProcess nodeShape = `lin-rect` // Lined Process (Rectangle with shadow) NodeShapeStartSmall nodeShape = `sm-circ` // Start (Small circle) NodeShapeStopFramed nodeShape = `fr-circ` // Stop (Circle with frame) NodeShapeForkJoin nodeShape = `fork` // Fork/Join NodeShapeCollate nodeShape = `hourglass` // Collate (Hourglass) NodeShapeComment nodeShape = `brace` // Comment (Left brace) NodeShapeCommentRight nodeShape = `brace-r` // Comment Right (Right brace) NodeShapeCommentBothSides nodeShape = `braces` // Comment (Both braces) NodeShapeComLink nodeShape = `bolt` // Com Link (Lightning bolt) NodeShapeDocument nodeShape = `doc` // Document NodeShapeDelay nodeShape = `delay` // Delay NodeShapeStorage nodeShape = `h-cyl` // Storage (Horizontal cylinder) NodeShapeDiskStorage nodeShape = `lin-cyl` // Disk Storage (Lined cylinder) NodeShapeDisplay nodeShape = `curv-trap` // Display (Curved trapezoid) NodeShapeDividedProcess nodeShape = `div-rect` // Divided Process NodeShapeExtract nodeShape = `tri` // Extract (Triangle) NodeShapeInternalStorage nodeShape = `win-pane` // Internal Storage NodeShapeJunction nodeShape = `f-circ` // Junction (Filled circle) NodeShapeLinedDocument nodeShape = `lin-doc` // Lined Document NodeShapeLoopLimit nodeShape = `notch-pent` // Loop Limit NodeShapeManualFile nodeShape = `flip-tri` // Manual File NodeShapeManualInput nodeShape = `sl-rect` // Manual Input (Sloped rectangle) NodeShapeMultiDocument nodeShape = `docs` // Multi-Document NodeShapeMultiProcess nodeShape = `st-rect` // Multi-Process NodeShapePaperTape nodeShape = `flag` // Paper Tape NodeShapeStoredData nodeShape = `bow-rect` // Stored Data NodeShapeSummary nodeShape = `cross-circ` // Summary (Circle with cross) NodeShapeTaggedDocument nodeShape = `tag-doc` // Tagged Document NodeShapeTaggedProcess nodeShape = `tag-rect` // Tagged Process )
List of possible Node shapes. Reference: https://mermaid.js.org/syntax/flowchart.html#complete-list-of-new-shapes
const ( SubgraphDirectionNone subgraphDirection = "" SubgraphDirectionTopToBottom subgraphDirection = "TB" SubgraphDirectionBottomUp subgraphDirection = "BT" SubgraphDirectionRightLeft subgraphDirection = "RL" SubgraphDirectionLeftRight subgraphDirection = "LR" )
List of possible Subgraph directions. Reference: https://mermaid.js.org/syntax/flowchart.html#direction
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Class ¶
Classes are a convenient way of creating a node style since you can attach them directly to a node. Reference: https://mermaid.js.org/syntax/flowchart.html#classes
type Flowchart ¶
type Flowchart struct { basediagram.BaseDiagram[FlowchartConfigurationProperties] Direction flowchartDirection CurveStyle curveStyle // contains filtered or unexported fields }
Flowcharts are composed of nodes (geometric shapes) and links (arrows or lines). The Mermaid code defines how nodes and links are made and accommodates different arrow types, multi-directional arrows, and any linking to and from subgraphs. Reference: https://mermaid.js.org/syntax/flowchart.html
func (*Flowchart) AddClass ¶
AddClass adds a new class to the flowchart and returns the created class.
func (*Flowchart) AddLink ¶
AddLink adds a new link between two nodes in the flowchart and returns the created link.
func (*Flowchart) AddSubgraph ¶
AddSubgraph adds a new subgraph to the flowchart and returns the created subgraph.
func (*Flowchart) RenderToFile ¶
RenderToFile saves the flowchart diagram to a file at the specified path.
func (*Flowchart) SetDirection ¶
SetDirection sets the flowchart direction and returns the flowchart for chaining
type FlowchartConfigurationProperties ¶
type FlowchartConfigurationProperties struct { basediagram.ConfigurationProperties // contains filtered or unexported fields }
FlowchartConfigurationProperties holds flowchart-specific configuration
func NewFlowchartConfigurationProperties ¶
func NewFlowchartConfigurationProperties() FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetArrowMarkerAbsolute ¶
func (c *FlowchartConfigurationProperties) SetArrowMarkerAbsolute(v bool) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetCurve ¶
func (c *FlowchartConfigurationProperties) SetCurve(v string) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetDefaultRenderer ¶
func (c *FlowchartConfigurationProperties) SetDefaultRenderer(v string) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetDiagramPadding ¶
func (c *FlowchartConfigurationProperties) SetDiagramPadding(v int) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetHtmlLabels ¶
func (c *FlowchartConfigurationProperties) SetHtmlLabels(v bool) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetNodeSpacing ¶
func (c *FlowchartConfigurationProperties) SetNodeSpacing(v int) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetPadding ¶
func (c *FlowchartConfigurationProperties) SetPadding(v int) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetRankSpacing ¶
func (c *FlowchartConfigurationProperties) SetRankSpacing(v int) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetTitleTopMargin ¶
func (c *FlowchartConfigurationProperties) SetTitleTopMargin(v int) *FlowchartConfigurationProperties
func (*FlowchartConfigurationProperties) SetWrappingWidth ¶
func (c *FlowchartConfigurationProperties) SetWrappingWidth(v int) *FlowchartConfigurationProperties
func (FlowchartConfigurationProperties) String ¶
func (c FlowchartConfigurationProperties) String() string
type Link ¶
type Link struct { Shape linkShape Head linkArrowType Tail linkArrowType Text string From *Node To *Node Length int }
Link represents a connection between nodes in a flowchart
type Node ¶
Node represents a node in a flowchart
func NewNode ¶
NewNode creates a new Node with the given ID and text, setting default shape to round edges.
type NodeStyle ¶
func NewNodeStyle ¶
func NewNodeStyle() (newNodeStyle *NodeStyle)
NewNodeStyle creates a new NodeStyle with default stroke width and dash settings.
type Subgraph ¶
type Subgraph struct { ID string Title string Direction subgraphDirection // contains filtered or unexported fields }
func NewSubgraph ¶
NewSubgraph creates a new Subgraph with the given ID and title, setting the default direction to none.
func (*Subgraph) AddSubgraph ¶
AddSubgraph adds a new Subgraph to the current Subgraph and returns the created subgraph.