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).

!7

!include once #1013695 // GraphViz

import guru.nidi.graphviz.attribute.*;
import static guru.nidi.graphviz.attribute.Records.*;
import static guru.nidi.graphviz.model.Compass.*;
import guru.nidi.graphviz.model.Node;
import java.awt.Color;

p {
  File img = img = programFile("graph.png");

  Node
    node0 = node("node0").with(Records.of(rec("f0", ""), rec("f1", ""), rec("f2", ""), rec("f3", ""), rec("f4", ""))),
    node1 = node("node1").with(Records.of(turn(rec("n4"), rec("v", "719"), rec("")))),
    node2 = node("node2").with(Records.of(turn(rec("a1"), rec("805"), rec("p", "")))),
    node3 = node("node3").with(Records.of(turn(rec("i9"), rec("718"), rec("")))),
    node4 = node("node4").with(Records.of(turn(rec("e5"), rec("989"), rec("p", "")))),
    node5 = node("node5").with(Records.of(turn(rec("t2"), rec("v", "959"), rec("")))),
    node6 = node("node6").with(Records.of(turn(rec("o1"), rec("794"), rec("")))),
    node7 = node("node7").with(Records.of(turn(rec("s7"), rec("659"), rec(""))));
    
  Graph g = graph("example3").directed()
    .generalAttr().with(RankDir.LEFT_TO_RIGHT)
    .with(
            node0.link(
                    between(loc("f0"), node1.loc("v", SOUTH)),
                    between(loc("f1"), node2.loc(WEST)),
                    between(loc("f2"), node3.loc(WEST)),
                    between(loc("f3"), node4.loc(WEST)),
                    between(loc("f4"), node5.loc("v", NORTH))),
            node2.link(between(loc("p"), node6.loc(NORTH_WEST))),
            node4.link(between(loc("p"), node7.loc(SOUTH_WEST))));
  Graphviz.fromGraph(g).width(900).render(Format.PNG).toFile(img);

  showImage(img);
}

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: 526 / 1222
Version history: 5 change(s)
Referenced in: