-
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
Enable cluster branding #279
Comments
There is a pull request to allow Icons for Clusters #90 |
What about this? from diagrams.azure.compute import AKS, ContainerInstances
graph_attr = {
"splines":"curved",
"layout":"neato",
}
with Diagram('\ndemo', show=False, graph_attr=graph_attr) as diag:
with Cluster("Sync-service"):
aks_cluster = AKS(
label="AKS", fontsize="6", loc="t",
fixedsize="true", width="0.5", height="0.8",
pin="true", pos="0,2")
cont1 = ContainerInstances("Pod", pin="true", pos="1,1")
blank = Node(shape="plaintext", pin="true", pos="2,1" )
diag |
Please, check #407 it's a refactor of Nodes to be used as Clusters and add the node icon to the Cluster |
please check my new PR #439 which implement the feature based on @givanovexpe @bkmeneguello & my work |
I tried this, but I am not able to position it correctly, whatever I give in position, it's not changing. It's just this. |
@seema1711 please show your code. My first guess is that you are not using This code works for me: from diagrams import Diagram, Cluster
from diagrams.aws.general import OfficeBuilding, TraditionalServer
from diagrams.onprem.client import Client
graph_attr = {
"splines":"curved",
"layout":"neato",
}
with Diagram('\ndemo', show=False, graph_attr=graph_attr) as diag:
with Cluster(""):
ofb = OfficeBuilding(
label="", fontsize="6", loc="t",
fixedsize="true", width="0.5", height="0.8",
pin="true", pos="0,2")
cli = Client("", pin="true", pos="1,1")
ser = TraditionalServer("", pin="true", pos="3,1" )
diag |
I have many clusters in my code, if I am using neato then it's just creates a mess with other clusters.
And also I tried your code, it doesn't display the border of the cluster: I tried using other method also, I got this error. |
With neato, you have to specify the positions of each node for the whole Graph. (Note: neato does have automatic positioning algorithms, but you have to specify them) Also, you can't nest the clusters. (Note: you can but, you loose some of the cluster's attributes) Please show the code for the other clusters and nodes I see in your graph. |
Okay, is there any other way for cluster branding? |
I think "neato/circo/twopi" don't display subgraphs, it's a limitation. Possibly with "fdp" you could have a result similar to "neato" with subgraphs. |
the solution dan-ash and bkmeneguello are working on will be much better, but in the meantime you will have to do something like the following: from diagrams import Diagram, Node, Edge, Cluster
from diagrams.aws.network import DirectConnect, VPCRouter, TransitGateway
from diagrams.aws.general import OfficeBuilding, TraditionalServer
from diagrams.onprem.client import Client
graph_attr = {
"splines":"curved",
"layout":"neato",
}
with Diagram('\ndemo', show=False, graph_attr=graph_attr) as diag:
with Cluster(""):
Node("", shape="plaintext", pin="true", pos="-1,-1")
Node("", shape="plaintext", pin="true", pos="10,6")
ofb = OfficeBuilding(
label="", fontsize="6", loc="t",
fixedsize="true", width="0.5", height="0.8",
pin="true", pos="-1,6")
with Cluster("client", graph_attr={"bgcolor":"azure"}):
Node("", shape="plaintext", pin="true", pos="0,4")
Node("", shape="plaintext", pin="true", pos="5.5,5.5")
pc = Client("\t\t\t\tOn Prem User \nAccess dares over HTTP", pin="true", pos="1,5")
tradServer = TraditionalServer("DWH Database \nwith mixed \nmode authentication", pin="true", pos="5,5")
with Cluster("vpc1", graph_attr={"bgcolor":"thistle"}):
Node("", shape="plaintext", pin="true", pos="0,0")
Node("", shape="plaintext", pin="true", pos="3,2")
cd1 = DirectConnect("", pin="true", pos="0.5,1")
vpcr1 = VPCRouter("", pin="true", pos="2.5,1" )
with Cluster("vpc2", graph_attr={"bgcolor":"seagreen3"}):
Node("", shape="plaintext", pin="true", pos="5,1.5")
Node("", shape="plaintext", pin="true", pos="9,2.5")
tg = TransitGateway("", pin="true", pos="6,2")
vpcr2 = VPCRouter("", pin="true", pos="8,2" )
diag |
Okay, I will try that. Thank you @clayms @bkmeneguello |
I don't know why but when I try this it's not showing any clusters. #279 (comment) |
@seema1711 if you are indeed running exactly what I posted in a fresh session, then I have no idea. My first guess is that you might be using a different versions, but that is just a guess. Please post the exact code you are using. My installations: $ dot -V
dot - graphviz version 2.38.0 (20140413.2041) $ pip freeze
...
diagrams==0.18.0
...
graphviz==0.13.2
... |
It worked actually, I found out that I was using neato instead of dot. Thanks for the help. |
I copied the same code but with any layout like neato, dot and fdp i couldn't get the same . Please help |
I have copied the code and cluster doesn't show |
To add clarity to any deep dive design it would be helpful if users could add a brand / type to a cluster object:
say I have a complicated design including an AKS cluster with its own internal design - with this capability added I could then mark the cluster to be AKS and have perhaps a small AKS logo on the side to enhance the drill down clarity of the diagram.
The text was updated successfully, but these errors were encountered: