diff --git a/conntrackt/utils.py b/conntrackt/utils.py --- a/conntrackt/utils.py +++ b/conntrackt/utils.py @@ -155,8 +155,8 @@ def generate_project_diagram(project): # Get distinct colours, one for each node/entity. colors = get_distinct_colors(entities.count()) - # Created nodes based on entities, and put them into correct cluster. - for entity in entities: + # Create nodes based on entities, and put them into correct cluster. + for entity in entities.order_by("pk"): # Try to get the existing cluster based on location name. location = entity.location @@ -169,7 +169,7 @@ def generate_project_diagram(project): clusters[cluster_name] = cluster # Fetch a colour that will be associated with the node/entity. - node_color = colors.pop() + node_color = colors.pop(0) node_colors[entity.id] = node_color.hex # Determine whether the node label should be black or white based on brightness of node colour.