You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 17, 2024. It is now read-only.
Install React as peerDependencies at the same time.
Example
importReactfrom'react';import{Digraph,Node,Subgraph,Edge,DOT,renderToDot}from'@ts-graphviz/react';constExample=()=>(<Digraphrankdir="TB"edge={{color: 'blue',fontcolor: 'blue',}}node={{shape: 'none',}}><Nodeid="nodeA"shape="none"label={<DOT.TABLEBORDER="0"CELLBORDER="1"CELLSPACING="0"><DOT.TR><DOT.TD>left</DOT.TD><DOT.TDPORT="m">middle</DOT.TD><DOT.TDPORT="r">right</DOT.TD></DOT.TR></DOT.TABLE>}/><Subgraphid="cluster"label="Cluster"labeljust="l"><Nodeid="nodeB"label="This is label for nodeB."/></Subgraph><Edgetargets={['nodeB','nodeA:m']}comment="Edge from node A to B"label={<DOT.B>A to B</DOT.B>}/></Digraph>);constdot=renderToDot(<Example/>);console.log(dot);
Output dot
digraph {
rankdir = "TB";
edge [
color = "blue",
fontcolor = "blue",
];
node [
shape = "none",
];
"nodeA" [
shape = "none",
label = <<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD>left</TD><TD PORT="m">middle</TD><TD PORT="r">right</TD></TR></TABLE>>,
];
subgraph"cluster" {
labeljust = "l";
label = "Cluster";
"nodeB" [
label = "This is label for nodeB.",
];
}
// Edge from node A to B"nodeB"->"nodeA":"m" [
label = <<B>A to B</B>>,
];
}