You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I’m trying to create a diagram where I have multiple items arranged in rows instead of all being in a single row. Currently, all the items are displayed in one long row, which makes it difficult to read and understand the diagram clearly. I’m aiming to split the items into multiple rows so that the layout is more organized and easier to visualize. Do you have any suggestions or solutions for achieving this?
from diagrams import Diagram, Cluster, Edge
from diagrams.azure.compute import AKS
from diagrams.k8s.ecosystem import Helm
from diagrams.onprem.network import Nginx
from diagrams.onprem.gitops import Argocd
from diagrams.custom import Custom
from diagrams.azure.network import DNSZones
# Custom class for handling custom icons
class MyCustomDiagram(Custom):
def __init__(self, label, icon_path):
super().__init__(label, icon_path=icon_path)
# Define common graph attributes
_default_graph_attrs = {
"fontsize": "35",
"nodesep": "4.0",
"ranksep": "2.0"
}
_cluster_default_graph_attrs = {
"bgcolor": "white",
"fontsize": "30"
}
_app_default_graph_attrs = {
"fontsize": "18"
}
# Define common edge attributes
common_edge_attrs = {
"color": "blue",
"style": "solid",
"label": "Helm"
}
# Define a function to create a common cluster layout
def create_applications_cluster(cluster_name, app_list):
with Cluster(cluster_name, graph_attr=_app_default_graph_attrs):
for app in app_list:
if "label" in app:
app["object"] = MyCustomDiagram(app["label"], app["icon_path"])
else:
app["object"] = MyCustomDiagram("", app["icon_path"])
yield app["object"]
# __directions = ("TB", "BT", "LR", "RL")
# Create the main diagram
with Diagram("CPC infrastructure", show=False, direction="TB", graph_attr=_default_graph_attrs):
with Cluster("App cluster", graph_attr=_cluster_default_graph_attrs):
argocd = Argocd("ArgoCD")
rancher = MyCustomDiagram("Rancher", "/Users/mnadav/Downloads/linode/images/rancher.png")
# Applications inside Red Panda Cluster
apps = {
"NGINX Ingress": {"label": "NGINX Ingress", "icon_path": "/Users/mnadav/Downloads/linode/images/nginx.png"},
"Cert Manager": {"label": "Cert Manager", "icon_path": "/Users/mnadav/Downloads/linode/images/cert-manager.png"},
"external-dns": {"icon_path": "/Users/mnadav/Downloads/linode/images/external-dns.png"},
"External Secrets": {"label": "External Secrets", "icon_path": "/Users/mnadav/Downloads/linode/images/external-secrets.png"},
"Calico": {"label": "Calico", "icon_path": "/Users/mnadav/Downloads/linode/images/calico.jpeg"},
"Keda": {"icon_path": "/Users/mnadav/Downloads/linode/images/keda.png"},
"Keel": {"label": "Keel", "icon_path": "/Users/mnadav/Downloads/linode/images/keel.png"},
"Memcached": {"icon_path": "/Users/mnadav/Downloads/linode/images/memcached.png"},
"Redis": {"icon_path": "/Users/mnadav/Downloads/linode/images/redis.png"},
"Reloader": {"label": "Reloader", "icon_path": "/Users/mnadav/Downloads/linode/images/reloader.png"},
"Victoria Metrics": {"label": "Victoria Metrics", "icon_path": "/Users/mnadav/Downloads/linode/images/victoria-metrics.jpeg"},
"Linkerd": {"label": "Linkerd", "icon_path": "/Users/mnadav/Downloads/linode/images/linkerd.png"},
"Metrics Server": {"icon_path": "/Users/mnadav/Downloads/linode/images/metrics-server.png"},
"Wiz": {"icon_path": "/Users/mnadav/Downloads/linode/images/wiz.png"}
}
# Iterate over the dictionary values
for app in create_applications_cluster("Argocd Infra Applications", apps.values()):
argocd >> Edge(**common_edge_attrs) >> app
The text was updated successfully, but these errors were encountered:
Hey, I’m trying to create a diagram where I have multiple items arranged in rows instead of all being in a single row. Currently, all the items are displayed in one long row, which makes it difficult to read and understand the diagram clearly. I’m aiming to split the items into multiple rows so that the layout is more organized and easier to visualize. Do you have any suggestions or solutions for achieving this?
The text was updated successfully, but these errors were encountered: