blushft / go-diagrams Goto Github PK
View Code? Open in Web Editor NEWCreate beautiful system diagrams with Go
License: MIT License
Create beautiful system diagrams with Go
License: MIT License
I set a node label to a string with a .
in it.
The graphviz output did not wrap the label in quotes.
Should be label="thing.name"
but is label=thing.name
When I am using dot
to produce JPG or PNG file I receive such a Warning:
dot -Tjpg app.dot > ./1.jpg
Warning: #@D3436 is not a known color.
Note that all over other places code has #2D3436
not #@D3436
.
https://github.com/blushft/go-diagrams/blob/master/diagram/node.go#L140
Hello,
I would kindly ask, if this repo is still maintained and kept up-to-date with features from diagrams?
Thank you
Thanks for this nice port!
If I checked the code correctly something like adding a label text to an arrow is not implemented yet, correct?
I'm thinking about something like mingrammer/diagrams#54, implemented in mingrammer/diagrams#48.
What would be required to add this to this port?
Small usability issue. I'm attempting to render a diagram that uses the GCP Pubsub icon (which the asset package does not appear to have).
I thought I might be able to diagram.NewNode(diagram.Icon("pubsub.png")).Label("QueueName")
but I noticed that node render expects the image path to be in the asset box. Would it be possible to fall back to local disk? Or maybe better yet provide a NodeOption
like CustomImage
to support custom icons?
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 1,
"properties": {
"ID": 0
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-90,35],
[-90,30],
[-85,30],
[-85,35],
[-90,35]
]
]
}
}
]
}
``` topojson
{
"type": "Topology",
"transform": {
"scale": [0.0005000500050005, 0.00010001000100010001],
"translate": [100, 0]
},
"objects": {
"example": {
" type": "GeometryCollection",
"geometries": [
{
"type": "Point",
"properties": {"prop0": "value0"},
"coordinates": [4000, 5000]
},
{
"type" : "LineString",
"คุณสมบัติ": {"prop0":"value0", "prop1": 0},
"arcs": [0]
},
{
"type": "Polygon",
"คุณสมบัติ": {"prop0": "value0",
"prop1": {"นี้": "นั่น"}
},
"ส่วนโค้ง": [[1]] }
]
}
}
,
"ส่วนโค้ง": [[[4000 , 0], [1999, 9999], [2000, -9999], [2000, 9999]],[[0, 0], [0, 9999], [2000, 0], [0, -9999], [-2000, 0]]]
}
solid cube_corner
facet ปกติ 0.0 -1.0 0.0 จุดยอด
วงรอบนอก
0.0 0.0 0.0
จุดยอด 1.0 0.0 0.0
จุดยอด 0.0 0.0 1.0
endloop
endfacet
facet ปกติ 0.0 0.0 -1.0 จุด ยอดวง
รอบนอก 0.0 0.0 0.0
จุดยอด 0.0
1.0 0.0
จุดยอด 1.0 0.0 0.0
endloop
endfacet
facet ปกติ -1.0 0.0 0.0 จุดยอด
วงรอบนอก
0.0 0.0 0.0
จุดยอด 0.0 0.0 1.0 จุด ยอด 0.0 1.0
0.0
endloop
endfacet
facet ปกติ 0.577 0.577 0.577
จุดยอดวงรอบนอก
1.0 0.0 0.0
จุดสุดยอด 0.0 1.0 0.0
จุดยอด 0.0 0.0 1.0
endloop
endfacet
endsolid
Hello there,
first of all thanks a lot for this library. :)
tl;dr: i've found issues with the default labels for groups and prepared a corresponding PR.
When trying it out, I found some issues with default labels, that can cause problems for newcomers especially if they don't know anything about graphviz.
The default label for a group is the empty string. When rendered, it produces label=;
which to graphviz is a syntax error. So, in order to produce a valid graph, at least the diagram.Label
option is needed, as far as I see it. If I'm not mistaken, this could be fixed by adding a call to trimAttrs
here: https://github.com/blushft/go-diagrams/blob/master/diagram/options.go#L39
d, err := diagram.New(
diagram.Label("TEST"),
)
The default label for a node is "node". This is a reserved keyword in graphviz and when left unescaped causes problems. Since graphviz has logic for automatically labelling nodes, I would suggest using empty string here, as well and letting graphviz set the label. The alternative would be something like "\"node\""
which doesn't feel right to me. But feel free to suggest that on the PR if you see it differently.
Hi. I'm a creator of Diagrams :)
I recently discovered this library and I'm happy that someone ported my Diagrams to my favorite language, Go. Thanks for your efforts!! 👍
I'd like to link this library in the Diagrams readme!
When running a go-diagram more then once, the Render method errors with the following message:
mkdir go-diagrams: file exists
Ideally Render supports the option to overwrite the dot file in the go-diagrams directory.
That would be neat.
I think this would require supporting newrank="true"
as a valid DiagramOption and support rank="same"
on subgraphs.
It might also be nice to support contraint=false
as an EdgeOption
As is, if the output directory already exists, this causes a pointless error.
Go-Diagrams is a loose port of diagram, is there a compare table to show what go-diagrams miss?
Use as label first 8 bytes from SHA1 digest in label and I think that I found some escape problem:
vkhkhzkc [ fixedsize=true, fontcolor="#2D3436", fontname="Sans-Serif", fontsize=13, height=2.1999999999999997, image="assets/gcp/database/sql.png", imagescale=true, label="2822b7f1...", labelloc=b, shape=none, style=rounded, width=1.4 ];
xnxdisdb [ fixedsize=true, fontcolor="#2D3436", fontname="Sans-Serif", fontsize=13, height=2.1999999999999997, image="assets/gcp/database/sql.png", imagescale=true, label=ca20af73..., labelloc=b, shape=none, style=rounded, width=1.4 ];
Look like label label=ca20af73...
sounds like string is't escape properly by go-diagrams.
As result cath an error in dot
processing:
Error: diagram.dot: syntax error in line 30 near '.'
Hi,
Thank you for your code! The code is under the MIT license, but I have noticed a sizable number of image assets that cover logos of various brands and entities, e.g. nginx, various clouds, languages, etc. What is the source of the images?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.