nidi3 / graphviz-java

Use graphviz with pure java
Apache License 2.0
937 stars 107 forks source link

Rendering Problem #118

Closed BaroDevelopment closed 4 years ago

BaroDevelopment commented 5 years ago

Hello,

I've copy pasted the example code from the the README.md. It is working actually but the problem is the size of the generated image. It looks like this: grafik

but actually it should look like this: grafik

I don't know what is wrong. The code is a simple copy paste from the examples and looks like this:

        Graph g = graph("example1").directed()
                .graphAttr().with(RankDir.LEFT_TO_RIGHT)
                .with(
                        node("a").with(Color.RED).link(node("b")),
                        node("b").link(to(node("c")).with(Style.DASHED))
                );
        try {
            Graphviz.fromGraph(g).height(100).render(Format.PNG).toFile(new File("example/ex1.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
dhu2017 commented 5 years ago

This bug appears in the latest versions. After rolled back to v0.8.0, it's working properly.

nidi3 commented 5 years ago

I changed something in 0.8.4 regarding the image size. But I cannot reproduce this issue neither with 0.8.0 nor with 0.8.10. The resulting image has always 100px height. Maybe it's the graphviz version you have on your machine, can you try adding Graphviz.useEngine(new GraphvizV8Engine()) at the beginning?

nidi3 commented 5 years ago

I found an issue that could cause your problem. It is fixed in version 0.11.0. Please check it out.

jorgemera commented 4 years ago

hi, how can i do to start and configure the Graphviz.useEngine () method?

nidi3 commented 4 years ago

Just call Graphviz.useEngine(new GraphvizV8Engine()) at the beginning of your program.

nidi3 commented 4 years ago

Additionally in version 0.11.1, the image sizing is improved and maybe thus the issue is solved?

nidi3 commented 4 years ago

Any news here?

nidi3 commented 4 years ago

Closing this. Feel free to reopen if the problem is still here.