Skip to content
This repository was archived by the owner on Mar 17, 2024. It is now read-only.

Commit 04807cb

Browse files
committed
update README
1 parent f694ede commit 04807cb

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,28 @@ $ npm install @ts-graphviz/react
2323

2424
```tsx
2525
import React, { FC } from 'react';
26-
import { Digraph, Node, Subgraph, renderToDot, Edge } from '@ts-graphviz/react';
26+
import { Digraph, Node, Subgraph, renderToDot, Edge, DOT } from '@ts-graphviz/react';
2727

2828
const Example: FC = () => (
2929
<Digraph dpi={150}>
30-
<Node id="nodeA" />
30+
<Node
31+
id="nodeA"
32+
shape="none"
33+
label={
34+
<DOT.TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
35+
<DOT.TR>
36+
<DOT.TD>left</DOT.TD>
37+
<DOT.TD PORT="m">middle</DOT.TD>
38+
<DOT.TD PORT="r">right</DOT.TD>
39+
</DOT.TR>
40+
</DOT.TABLE>
41+
}
42+
/>
3143

3244
<Subgraph id="cluster" label="Cluster" labeljust="l">
3345
<Node id="nodeB" label="This is label for nodeB." />
3446
</Subgraph>
35-
<Edge targets={['nodeA', 'nodeB']} comment="Edge from node A to B" label={<b>A to B</b>} />
47+
<Edge targets={['nodeB', 'nodeA:m']} comment="Edge from node A to B" label={<DOT.B>A to B</DOT.B>} />
3648
</Digraph>
3749
);
3850

@@ -46,7 +58,10 @@ console.log(dot);
4658
```dot
4759
digraph {
4860
dpi = 150;
49-
"nodeA";
61+
"nodeA" [
62+
shape = "none",
63+
label = <<table BORDER="0" CELLBORDER="1" CELLSPACING="0"><tr><td>left</td><td PORT="m">middle</td><td PORT="r">right</td></tr></table>>,
64+
];
5065
"nodeB";
5166
subgraph "cluster" {
5267
labeljust = "l";
@@ -56,7 +71,7 @@ digraph {
5671
];
5772
}
5873
// Edge from node A to B
59-
"nodeA" -> "nodeB" [
74+
"nodeB" -> "nodeA":"m" [
6075
label = <<b>A to B</b>>,
6176
];
6277
}

0 commit comments

Comments
 (0)