Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

38
LINES

< > BotCompany Repo | #1013696 // Test GraphViz 2 (Records, OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 15226K of libraries. Click here for Pure Java version (7920L/52K).

1  
!7
2  
3  
!include once #1013695 // GraphViz
4  
5  
import guru.nidi.graphviz.attribute.*;
6  
import static guru.nidi.graphviz.attribute.Records.*;
7  
import static guru.nidi.graphviz.model.Compass.*;
8  
import guru.nidi.graphviz.model.Node;
9  
import java.awt.Color;
10  
11  
p {
12  
  File img = img = programFile("graph.png");
13  
14  
  Node
15  
    node0 = node("node0").with(Records.of(rec("f0", ""), rec("f1", ""), rec("f2", ""), rec("f3", ""), rec("f4", ""))),
16  
    node1 = node("node1").with(Records.of(turn(rec("n4"), rec("v", "719"), rec("")))),
17  
    node2 = node("node2").with(Records.of(turn(rec("a1"), rec("805"), rec("p", "")))),
18  
    node3 = node("node3").with(Records.of(turn(rec("i9"), rec("718"), rec("")))),
19  
    node4 = node("node4").with(Records.of(turn(rec("e5"), rec("989"), rec("p", "")))),
20  
    node5 = node("node5").with(Records.of(turn(rec("t2"), rec("v", "959"), rec("")))),
21  
    node6 = node("node6").with(Records.of(turn(rec("o1"), rec("794"), rec("")))),
22  
    node7 = node("node7").with(Records.of(turn(rec("s7"), rec("659"), rec(""))));
23  
    
24  
  Graph g = graph("example3").directed()
25  
    .generalAttr().with(RankDir.LEFT_TO_RIGHT)
26  
    .with(
27  
            node0.link(
28  
                    between(loc("f0"), node1.loc("v", SOUTH)),
29  
                    between(loc("f1"), node2.loc(WEST)),
30  
                    between(loc("f2"), node3.loc(WEST)),
31  
                    between(loc("f3"), node4.loc(WEST)),
32  
                    between(loc("f4"), node5.loc("v", NORTH))),
33  
            node2.link(between(loc("p"), node6.loc(NORTH_WEST))),
34  
            node4.link(between(loc("p"), node7.loc(SOUTH_WEST))));
35  
  Graphviz.fromGraph(g).width(900).render(Format.PNG).toFile(img);
36  
37  
  showImage(img);
38  
}

Author comment

Began life as a copy of #1013688

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013696
Snippet name: Test GraphViz 2 (Records, OK)
Eternal ID of this version: #1013696/6
Text MD5: a82a5cb1de9a17497942c33bad6fdcf5
Transpilation MD5: a5c9d3bda81a212e7aec3a0266aa4058
Author: stefan
Category: javax / diagrams
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-22 17:35:42
Source code size: 1698 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 363 / 826
Version history: 5 change(s)
Referenced in: [show references]