All sample values in this document represent default values unless explicitly stated as overrides.
You don't need to explicitly specify the settings if you are OK with the default values.
Global settings needs to be declared at the beginning, before the declaration of any nodes or links.
direction: right
Sets the overall flowchart direction. Options are:
rightdownleftup
routingStyle: orthogonal
Defines the style for routing links between nodes. Options are:
orthogonalsplinespolyline
spacing: 64
Minimum: 16
Defines the space between adjacent nodes.
nodePadding: 32
Sets global padding for all nodes, controlling the space between text inside a node and its edges. This padding may affect the overall node size.
You can override this setting for individual nodes:
A {
padding: 24 // overrides the default
}
Note: Padding assumes a rectangular node shape. For non-rectangular shapes, they are fully contained within this rectangle. If padding is too small for non-rectangular shapes, text may not fit properly.
Padding values can be set as:
- A single number for uniform vertical and horizontal padding.
- Two numbers where the first applies to vertical padding, and the second to horizontal padding.
linkStyle: solid
Defines the link style. Options are:
soliddasheddotted
This value could be overriden per link:
A ->{style: dotted} B
borderWidth: 2
Sets the border width for all nodes.
This value could be overriden per node:
A {
borderWidth: 8
}
nodeShape: rect
Default shape for all nodes.
Options are:
rectcircleellipsediamond
This value could be overriden per node:
A {
shape: circle
}
arrowHeads: end
Where to show an arrow head on links. By default it will show at the end of
the link. Set it to none to disable arrow heads. Set it to both to show
arrow heads at both ends.
Options ares:
endnoneboth
This value could be overriden per link:
A ->{ arrowHeads: both } B
rectRadius: 0
This option can be specified when the node shape is rect. It will make the
rectangle to have round corners if you specify a value greater than 0.
This value could be overriden per node:
A { rectRadius: 8 }
bgColor: none
The overall background color for the whole chart. By default it is transparent.
Transparent background may not look very well in some dark-themed pages. Since
the background color or foreground color will be too similar. In such case, you
can specify a bgColor, such as white.
none or not specified at all means background is transparent.
This value could be overriden per node:
A { bgColor: gray }
This value could be overriden per link:
A ->{label: hello; bgColor: lightgray} B
And it changes the link's label's background color.
fgColor: black
The overall foreground color for the whole chart.
This value could be overriden per node:
A { fgColor: darkblue }
This value could be overriden per link:
A ->{label: hello; bgColor: darkblue} B
Here are all the settings that applies to nodes to override global settings:
paddingoverrrides globalnodePaddingborderWidthoverrides globalborderWidthshapeoverrides globalnodeShaperectRadiusoverrides globalrectRadiusbgColoroverrides globalbgColor
A { label: User A }
Label of the node. If not specified, the node ID (A in the sample about) will
be used as label. Label will show in the center of the node.
Here are all the settings that applies to nodes to override global settings:
styleoverrrides globallinkStylearrowHeadsoverrides globalarrowHeads
A ->{label: ❤️} B
Show a label on the link. It is optional.
Anything followed by // are considerd as comments:
// global settings
direction: down // other options are up, left and right
routingStyle: splines
Code above is equivalent to:
direction: down
routingStyle: splines
If label text contains //, you will need to escape it:
A { label: http:\//www.example.com}