Graphviz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks.
Abstract grammar for defining Graphviz nodes, edges, graphs, subgraphs, and clusters.
Install dependency below.
Load graphviz and feed dot string to generate svg string.
The svg
variable is a generated html string like below.
Render it through modern front-end framework (ex: vue)
or call graphviz api to bind api
Harray! You get a simple direct graph!
There are some other layout programs to choose, check this out.
Text label attached to objects
Vertical placement of labels for nodes, root graphs and clusters
type: string
, default: t
(clusters) , b
(root graphs) , c
(nodes)
External label for a node or edge
Color used for text
Basic drawing color for graphics, not text
Set style information for components of the graph
In dot, nodesep specifies the minimum space between two adjacent nodes in the same rank, in inches
type: double
, default: 0.25
, minimum: 0.02
0.1 | 0.5 |
---|---|
Set direction of graph
type: rankdir
(TB
, BT
, RL
or LR
), default: TB
TB | BT | LR | RL |
---|---|---|---|
There are three main types of shapes : polygon-based, record-based and user-defined.
the shape of a node
Width of node, in inches
type: double
, default: 0.75
, minimum: 0.01
Height of node, in inches
type: double
, default: 0.5
, minimum: 0.02
Work
Graphviz
DOT