-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
re-arrange the diagram componentes #522
Comments
Hi @hisham-elbreky Can you provide more details about what you want to do? If you talk about order for display you can check the "direction" parameter. The first example with direction parameter set to TB for Top to Bottom. |
Thanks @gabriel-tessier that is really helpful to use direction, but seems it not works well with cluster I am trying to generate physical diagram with many clusters. The diagram depict zones, tiers, and then nodes and its connections, and I am trying to make each cluster/component in the right position |
For your case you may check about the edge length to push the clsuters and make space between, check the example in this comment which are very good: Also you can check about this issue which have a better example with direction: If you can put your code to generate your graph it may help to reproduce your problem and try to find a better solution. |
Thanks @gabriel-tessier I'd like to share with you my code here as a public github repo so anyone can share, participate, or take the benefit of opensource code |
So I looked at a few of this but I can't really figure how to get the item properly order, I also don't know why it re-orders differently from how they are added in code. This is something basic I have: with Diagram("Resilience Diagram", direction="LR") as diag:
region = Cluster("Region: us-central", direction="TB")
with region:
zones = [ 'us-central1-b', 'us-central1-c']
with Cluster('us-central1-a'):
db = SQL("Master")
GKE("Cluster Node") >> Edge(forward=True, reverse=True) >> db
for _ in zones:
with Cluster(_,graph_attr=zone_gattr):
GKE("Cluster Node") >> Edge(forward=True, reverse=True) >> db And this is the result (but I don't know why is us-central1-a in the middle? I want it to show as the first item): I've tried several things suggested on other posts like adding positions and changing the layout but that only either breaks it all for me or doesn't affect the result, so if there is any kind soul, with this how would I make sure central1-a is the first item? thanks |
how i can programmatically arrange the location of components (e.g. nodes and cluster) to be sorted in a specific way?
The text was updated successfully, but these errors were encountered: