Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node positioning question #223

Open
GreenRover opened this issue Sep 6, 2021 · 1 comment
Open

Node positioning question #223

GreenRover opened this issue Sep 6, 2021 · 1 comment

Comments

@GreenRover
Copy link

GreenRover commented Sep 6, 2021

Assuming this example:

Node a1 = node("A1");
        Node b1 = node("B1");
        Node c1 = node("C1");
        Node c2 = node("C2");
        List<LinkSource> linkSourcesB = new ArrayList<>();
        linkSourcesB.add(a1);
        linkSourcesB.add(b1);
        linkSourcesB.add(c1);
        linkSourcesB.add(c2);
        linkSourcesB.add(
                graph().graphAttr()
                        .with(Rank.inSubgraph(Rank.RankType.SAME), Rank.dir(TOP_TO_BOTTOM))
                        .with(a1, b1, c1)
        );
        linkSourcesB.add(
                graph().graphAttr()
                        .with(Rank.inSubgraph(Rank.RankType.SAME), Rank.dir(LEFT_TO_RIGHT))
                        .with(c1, c2)
        );
        linkSourcesB.add(a1.link(b1));
        linkSourcesB.add(b1.link(c1));
        linkSourcesB.add(c1.link(c2));


        Graph g = graph("broker2concentrator").directed()
                .graphAttr().with(Rank.dir(LEFT_TO_RIGHT))
                .nodeAttr().with(Font.name("arial"))
                .with(linkSourcesB);
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        Graphviz
                .fromGraph(g)
                .render(Format.PNG)
                .toOutputStream(outputStream);
        return outputStream.toByteArray();

The current result:
image

The wanted result:
expected

Is the wanted example possible and how?

Here a playground with full complexity:
https://dreampuf.github.io/GraphvizOnline/#digraph%20G%20%7B%0A%20%20%20%20%0A%20%20rankdir%20%3D%20TD%3B%0A%0A%20%20A1%20-%3E%20B1%20-%3E%20C1%20-%3E%20C2%0A%20%20%0A%20%20subgraph%20%7B%20%0A%20%20%20%20%20rank%20%3D%20sink%20%3B%20rankdir%20%3D%20TB%20%3B%20A1%3B%20B1%3B%20C1%3B%20%0A%20%20%7D%20%0A%20%20%0A%20%20subgraph%20%7B%20%0A%20%20%20%20%20rank%20%3D%20same%20%3B%20rankdir%20%3D%20LR%20%3B%20C1%3B%20C2%3B%20%0A%20%20%7D%20%0A%0A%20%20%0A%20%20A1_x1%20-%3E%20A1%0A%20%20A1_x2%20-%3E%20A1%0A%20%20A1_x3%20-%3E%20A1%0A%20%20A1_x4%20-%3E%20A1%0A%20%20A1_x99%20-%3E%20A1%0A%0A%20%20B1_x1%20-%3E%20B1%0A%20%20B1_x2%20-%3E%20B1%0A%20%20B1_x3%20-%3E%20B1%0A%20%20B1_x4%20-%3E%20B1%0A%20%20B1_x99%20-%3E%20B1%0A%0A%20%20C1_x1%20-%3E%20C1%0A%20%20C1_x2%20-%3E%20C1%0A%20%20C1_x3%20-%3E%20C1%0A%20%20C1_x4%20-%3E%20C1%0A%20%20C1_x99%20-%3E%20C1%0A%20%20%0A%20%20C2_x1%20-%3E%20C2%0A%20%20C2_x2%20-%3E%20C2%0A%20%20C2_x3%20-%3E%20C2%0A%20%20C2_x4%20-%3E%20C2%0A%20%20C2_x99%20-%3E%20C2%0A%7D

@GreenRover
Copy link
Author

here a possible solution. How is it possible to do this with the java api?

https://stackoverflow.com/questions/69080171/graphiz-direction-nodes-as-an-l/69081229?noredirect=1#comment122095835_69081229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant