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

cluster width, and position #276

Open
abhi0977 opened this issue Sep 12, 2020 · 12 comments
Open

cluster width, and position #276

abhi0977 opened this issue Sep 12, 2020 · 12 comments

Comments

@abhi0977
Copy link

Screenshot 2020-09-12 at 3 23 27 PM

this is how my diagram looks.
how can i set width, height and position of clusters?

@abhi0977 abhi0977 changed the title diagram width cluster width, and position Sep 12, 2020
@abhi0977
Copy link
Author

@mingrammer need your help here.

@steschuser
Copy link

Its a problem I have too.
I havent really got the time to look into it yet, tho.

My plan is to let diagrams generate a dot file as per #182
and see if I can mess with graphviz directly. Next step would be to incorporate that into the diagrams code directly.

@sitereliabilityengineer
Copy link

Hello @abhi0977 I'm experiencing a similar behavior. Had you managed to order or position the the nodes ?

Thanks.

@abhi0977
Copy link
Author

abhi0977 commented Oct 2, 2020

Hello @abhi0977 I'm experiencing a similar behavior. Had you managed to order or position the the nodes ?

Thanks.

Nope

@redNixon
Copy link

redNixon commented Oct 3, 2020

You didn't ask for it specifically but would you say the "problem" with your diagram is total width and lack of it autowrapping going on? Direct anwser though, positioning in relation to other graph objects is done using the rank graphiz attribute, but there are also size, pos, width, and several other attributes that would let you set what you are asking to set manually. I'd say most people are more often concerned about keeping the aspect ratio "readable" vs really trying to set sizes and positions by hand.

The ratio and size attributes passed in as graph_attrs to Diagram() is probably what you want, if not you can you be a little bit more clear about the flow positioning goal along with the code that generated that image?

@sitereliabilityengineer
Copy link

@redNixon I've tried changing ratio, size, ratio with different settings, and it didn't change nothing at all. Only to remember you, that I have approx 50 nodes of the same cluster, all in the same column, and I will prefer to be aligned in different columns.

Is not great having all the nodes in one column or at least to be presented in a webpage or report.

I will continue testing, but to be honest, I have no experience with graphviz at all.

Thanks!

@abhi0977
Copy link
Author

@sitereliabilityengineer correct,
even i've tried many things with size, ratio and width from graphviz documentation.
but it did't work.

@clayms
Copy link

clayms commented Oct 27, 2020

I have had some success using a transparent png (a non-existent png also works - if you don't mind the Warnings) in a Custom node, together with an Edge with the penwidth set to "0.0", i.e. Edge(penwidth="0.0").

I use the transparent Custom nodes as spacers to shift around the Clusters and use the transparent Edges to tie things down to a visible Node.

It is a pain though and you have to fuss around with it to get it how you want, and it is still rarely exactly what you want.

@clayms
Copy link

clayms commented Nov 4, 2020

@abhi0977
have a look at this answer: #243 (comment)

if you change the "layout" engine to either "neato" or "fdp", and then for each Node set the pin to "true" and set the pos (position) to the "x,y" you want.

@OzNetNerd
Copy link

I use the "invisible edge" method. See this answer for an example.

@pablodz
Copy link

pablodz commented Feb 4, 2023

I moved to d2 lang and life is better now https://text-to-diagram.com/?example=icons

@HariSekhon
Copy link

HariSekhon commented May 5, 2023

@pablodz I've also moved to D2 lang when I couldn't get cluster position placement as demonstrated in my diagram in #891, although since then that ticket has some good ideas thanks to @clayms.

D2 is awesome too... but it also has a limitation in that it can specify a position placement field called near but you can't connect positioned and unpositioned objects while using that, see terrastruct/d2#1285 so there's no free lunch... might have to mix and match engines for different use cases until this field matures more...

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

8 participants