-
Notifications
You must be signed in to change notification settings - Fork 70
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
Bad rendering #106
Comments
Looks to be working fine in this example in all 4 formats. package main
import (
"context"
"fmt"
"log"
"os"
"github.com/goccy/go-graphviz"
)
func main() {
ctx := context.Background()
gv, err := graphviz.ParseBytes([]byte(`
strict graph gr {
ranksep=".4"
nodesep=.05
margin=.05;
outputMode="edgesfirst";
node [shape=box, height=0, width=0, style=filled, fontsize=12, color="#ffc0c0", fontname="Helvetica"];
n0 [label="top"];
n1 [label="smain", style=bold, color="#ff0000"];
n3 [label="np", style=bold, color="#ff0000"];
n6 [label="ppart", style=bold, color="#ff0000"];
node [fontname="Helvetica-Oblique", color="#c0c0ff"];
n2 [label="werd"];
n4 [label="groot", style=bold, color="#0000ff"];
n5 [label="alarm", style=bold, color="#0000ff"];
n7 [label="Wel"];
n8 [label="meteen"];
n10 [label="geslagen"];
{rank=same; edge[style=invis]; n7 -- n2 -- n8 -- n4 -- n5 -- n10}
edge [sametail=true, samehead=true, color="#d3d3d3", fontname="Helvetica", fontsize=10];
n0 -- n1 [label=" -- "];
n1 -- n2 [label=" hd "];
n1 -- n3 [label=" su ", color="#000000"];
n1 -- n6 [label=" vc "];
n3 -- n4 [label=" mod ", color="#000000"];
n3 -- n5 [label=" hd ", color="#000000"];
n6 -- n7 [label=" mod "];
n6 -- n8 [label=" mod "];
n6 -- n3 [label=" svp ", color="#000000"];
n6 -- n10 [label=" hd "];
}`))
if err != nil {
log.Fatal("failed to parse graphviz: ", err)
}
g, err := graphviz.New(ctx)
if err != nil {
log.Fatal("failed to create graphviz: ", err)
}
formats := []graphviz.Format{graphviz.PNG, graphviz.SVG, graphviz.JPG, graphviz.XDOT}
for _, format := range formats {
f, err := os.Create(fmt.Sprintf("example.%s", format))
if err != nil {
log.Fatal("failed to create file: ", err)
}
defer f.Close()
if err := g.Render(ctx, gv, format, f); err != nil {
// don't exit here, just log the error
fmt.Printf("failed to render graph to %s: %v\n", format, err)
}
}
} |
Or is it a library version thing? This is my
|
I ran it on Maybe try to run it in docker on a different platform |
It’s likely an issue with the feature you are using. Does the rendering break with a simpler example as well ? If not, please provide a minimal sample. |
I'm also creating a PNG image. Running on mac, golang 1.22.9. I tried several go-graphvzi versions, it happens starting on v0.2.1, the graph is correct with v0.2.0, so it's highly likely due to this PR #92 according to v0.2.0...v0.2.1 This PR just fixes #24, the images wasn't render correctly previously before 0.2.1, this PR fixes it. So by default looks like the edge use that chubby style. But if I tried set the edge style it doesn't work
Not sure where does the |
Rendering of this graph is all wrong:
How it should look (rendered with the
dot
program):How it looks:
The text was updated successfully, but these errors were encountered: