Skip to content

Commit

Permalink
Updated jtg to use styles, updated util to draw LR
Browse files Browse the repository at this point in the history
  • Loading branch information
hyakuhei committed Dec 29, 2021
1 parent 080c84f commit 302e92d
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 50 deletions.
33 changes: 17 additions & 16 deletions examples/output/High Level Architecture.dot
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
digraph G {
compound=true;
rankdir="LR"
subgraph cluster1 {
label="High Level Architecture";
color="Black";
node16 [label="DHL" shape="box", margin="0.1", color="Grey"];
node16 [label="DHL" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
subgraph cluster2 {
label="AWS";
color="Coral1";
subgraph cluster3 {
label="FE VPC";
color="Coral1";
node4 [label="Nginx" shape="box", margin="0.1", color="Grey"];
node4 [label="Nginx" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster11 {
label="Backend VPC";
color="Coral1";
node12 [label="Ordering" shape="box", margin="0.1", color="Grey"];
node12 [label="Ordering" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
}
subgraph cluster5 {
label="Internet";
color="Coral1";
node6 [label="client" shape="box", margin="0.1", color="Grey"];
node6 [label="client" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster7 {
label="OCI";
color="Coral1";
node8 [label="Database" shape="box", margin="0.1", color="Grey"];
node8 [label="Database" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster9 {
label="Google Cloud";
color="Coral1";
node10 [label="GoogleOauth" shape="box", margin="0.1", color="Grey"];
node10 [label="GoogleOauth" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster13 {
label="Warehouse Systems";
color="Coral1";
node14 [label="Warehouse" shape="box", margin="0.1", color="Grey"];
node15 [label="Shipping" shape="box", margin="0.1", color="Grey"];
node14 [label="Warehouse" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
node15 [label="Shipping" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
}
node6->node4 [label="" dir=both, fontsize="10", penwidth="2", arrowsize="0.8"];
node4->node8 [label="" dir=both, fontsize="10", penwidth="2", arrowsize="0.8"];
node6->node10 [label="" dir=both, fontsize="10", penwidth="2", arrowsize="0.8"];
node4->node12 [label="" fontsize="10", penwidth="1", arrowsize="0.8"];
node12->node14 [label="" fontsize="10", penwidth="1", arrowsize="0.8"];
node14->node8 [label="" dir=both, fontsize="10", penwidth="2", arrowsize="0.8"];
node14->node15 [label="" fontsize="10", penwidth="1", arrowsize="0.8"];
node15->node16 [label="" fontsize="10", penwidth="1", arrowsize="0.8"];
node6->node4 [label="" dir=both, fontsize="10", penwidth="2.4", arrowsize="0.8"];
node4->node8 [label="" dir=both, fontsize="10", penwidth="2.4", arrowsize="0.8"];
node6->node10 [label="" dir=both, fontsize="10", penwidth="2.4", arrowsize="0.8"];
node4->node12 [label="" fontsize="10", penwidth="1.2", arrowsize="0.8"];
node12->node14 [label="" fontsize="10", penwidth="1.2", arrowsize="0.8"];
node14->node8 [label="" dir=both, fontsize="10", penwidth="2.4", arrowsize="0.8"];
node14->node15 [label="" fontsize="10", penwidth="1.2", arrowsize="0.8"];
node15->node16 [label="" fontsize="10", penwidth="1.2", arrowsize="0.8"];
}
Binary file modified examples/output/High Level Architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 15 additions & 14 deletions examples/output/User buys book.dot
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
digraph G {
compound=true;
rankdir="LR"
subgraph cluster1 {
label="User buys book";
color="Black";
node14 [label="DHL" shape="box", margin="0.1", color="Grey"];
node14 [label="DHL" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
subgraph cluster2 {
label="AWS";
color="Coral1";
subgraph cluster3 {
label="FE VPC";
color="Coral1";
node4 [label="Nginx" shape="box", margin="0.1", color="Grey"];
node4 [label="Nginx" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster7 {
label="Backend VPC";
color="Coral1";
node8 [label="Ordering" shape="box", margin="0.1", color="Grey"];
node8 [label="Ordering" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
}
subgraph cluster5 {
label="Internet";
color="Coral1";
node6 [label="client" shape="box", margin="0.1", color="Grey"];
node6 [label="client" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster9 {
label="Warehouse Systems";
color="Coral1";
node10 [label="Warehouse" shape="box", margin="0.1", color="Grey"];
node13 [label="Shipping" shape="box", margin="0.1", color="Grey"];
node10 [label="Warehouse" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
node13 [label="Shipping" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster11 {
label="OCI";
color="Coral1";
node12 [label="Database" shape="box", margin="0.1", color="Grey"];
node12 [label="Database" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
}
node6->node4 [label="1." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node4->node8 [label="2." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node8->node10 [label="3." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node10->node12 [label="4." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node12->node10 [label="5." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node10->node13 [label="6." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node13->node14 [label="7." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node6->node4 [label="1." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node4->node8 [label="2." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node8->node10 [label="3." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node10->node12 [label="4." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node12->node10 [label="5." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node10->node13 [label="6." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node13->node14 [label="7." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
}
Binary file modified examples/output/User buys book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 8 additions & 7 deletions examples/output/User lists books.dot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
digraph G {
compound=true;
rankdir="LR"
subgraph cluster1 {
label="User lists books";
color="Black";
Expand All @@ -9,22 +10,22 @@ compound=true;
subgraph cluster3 {
label="FE VPC";
color="Coral1";
node4 [label="Nginx" shape="box", margin="0.1", color="Grey"];
node4 [label="Nginx" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
}
subgraph cluster5 {
label="Internet";
color="Coral1";
node6 [label="client" shape="box", margin="0.1", color="Grey"];
node6 [label="client" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster7 {
label="OCI";
color="Coral1";
node8 [label="Database" shape="box", margin="0.1", color="Grey"];
node8 [label="Database" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
}
node6->node4 [label="1." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node4->node8 [label="2." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node8->node4 [label="3." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node4->node6 [label="4." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node6->node4 [label="1." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node4->node8 [label="2." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node8->node4 [label="3." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node4->node6 [label="4." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
}
Binary file modified examples/output/User lists books.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions examples/output/User login.dot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
digraph G {
compound=true;
rankdir="LR"
subgraph cluster1 {
label="User login";
color="Black";
Expand All @@ -9,24 +10,24 @@ compound=true;
subgraph cluster3 {
label="FE VPC";
color="Coral1";
node4 [label="Nginx" shape="box", margin="0.1", color="Grey"];
node4 [label="Nginx" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
}
subgraph cluster5 {
label="Internet";
color="Coral1";
node6 [label="client" shape="box", margin="0.1", color="Grey"];
node6 [label="client" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
subgraph cluster7 {
label="Google Cloud";
color="Coral1";
node8 [label="GoogleOauth" shape="box", margin="0.1", color="Grey"];
node8 [label="GoogleOauth" shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"];
}
}
node6->node4 [label="1." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node4->node6 [label="2." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node6->node8 [label="3." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node8->node6 [label="4." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node6->node4 [label="5." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node4->node6 [label="6." fontsize="14",penwidth="1.2",arrowsize="0.8"];
node6->node4 [label="1." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node4->node6 [label="2." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node6->node8 [label="3." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node8->node6 [label="4." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node6->node4 [label="5." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
node4->node6 [label="6." fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"];
}
Binary file modified examples/output/User login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/jtg.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def genGraph(doc, sceneName, compoundLinks=False, linkCounters=True, printLabels

_STYLES = {
'boundary':'color="Red"',
'node':'shape="Box"',
'link':'fontsize="22"'
'node':'shape="box", margin="0.1", color="Grey", fontsize="13", fontname="Helvetica"',
'link':'fontsize="13", penwidth="1.2", arrowsize="0.8", fontname="Helvetica"'
}

graphContainer = graph.newSubgraph(sceneName, style='color="Black"')
Expand Down Expand Up @@ -59,7 +59,7 @@ def genGraph(doc, sceneName, compoundLinks=False, linkCounters=True, printLabels

parentBoundary = drawnBoundaries[key]

drawnActors[actor] = graph.newNode(actor, parent=parentBoundary)
drawnActors[actor] = graph.newNode(actor, parent=parentBoundary, style=_STYLES['node'])

linkCounter += 1

Expand All @@ -71,7 +71,7 @@ def genGraph(doc, sceneName, compoundLinks=False, linkCounters=True, printLabels
flowLabel = flowLabel + flow["data"]

link = graph.newLink(
drawnActors[flow["from"]], drawnActors[flow["to"]], label=flowLabel, style='fontsize="14",penwidth="1.2",arrowsize="0.8"'
drawnActors[flow["from"]], drawnActors[flow["to"]], label=flowLabel, style=_STYLES['link']
)

return graph
Expand Down
1 change: 1 addition & 0 deletions src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def dot(self, compoundLinks=False) -> str:

dotStrings.append("digraph G {")
dotStrings.append("compound=true;")
dotStrings.append('rankdir="LR"')

for sub in [x for x in self._subgraphs if x["parent"] == None]:
self.recurse(sub, dotStrings)
Expand Down

0 comments on commit 302e92d

Please sign in to comment.