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

Labels position on big diagram #824

Open
AxelBayle opened this issue Jan 5, 2023 · 1 comment
Open

Labels position on big diagram #824

AxelBayle opened this issue Jan 5, 2023 · 1 comment

Comments

@AxelBayle
Copy link

Hi, we are using the lib to generate all diagrams in our project and it's working perfectly fine. But we have a small issue for our api diagram. Indeed, we have a lot of api route and we wanted to add the label on each edge but somehow the labels are misplacing and we have them at the bottom and not on label ( it's like they are "pushed" by the others edges to the bottom).

Here is the img we get :
api

And here is the file use to generate it as pdf because it can't put it as .py file ( sorry if not really beautiful we generate it automatically) :

from diagrams.aws.analytics import *
from diagrams.aws.ar import *
from diagrams.aws.blockchain import *
from diagrams.aws.business import *
from diagrams.aws.compute import *
from diagrams.aws.cost import *
from diagrams.aws.database import *
from diagrams.aws.devtools import *
from diagrams.aws.enablement import *
from diagrams.aws.enduser import *
from diagrams.aws.engagement import *
from diagrams.aws.game import *
from diagrams.aws.general import *
from diagrams.aws.integration import *
from diagrams.aws.iot import *
from diagrams.aws.management import *
from diagrams.aws.media import *
from diagrams.aws.migration import *
from diagrams.aws.ml import *
from diagrams.aws.mobile import *
from diagrams.aws.network import *
from diagrams.aws.quantum import *
from diagrams.aws.robotics import *
from diagrams.aws.satellite import *
from diagrams.aws.security import *
from diagrams.aws.storage import *

with Diagram(
    "api",
    filename=r"img/api",
    show=False,
    graph_attr={"fontsize": "20", "forcelabels": "true"},
    edge_attr={"fontsize": "12"},
    node_attr={"fontsize": "15", "fontname": "times"},
):
    clm_user_pool = Cognito("clm_user_pool")
    web_bucket = S3("web_bucket")
    clm_alb = ELB("clm_alb")
    reverse_proxy = Lambda("reverse_proxy")
    clm_record = Route53("clm_record")
    config = S3("config")
    authorizer = Lambda("authorizer")
    whoami = Lambda("whoami")
    clm_api = APIGateway("clm_api")
    load_balancer_to_api = Lambda("load_balancer_to_api")
    with Cluster("DB Mapping"):
        entity_mapping = DDB("entity_mapping")
        icao_customer_regions = DDB("icao_customer_regions")
        aircraft_family = DDB("aircraft_family")
    with Cluster("DB Cluster"):
        entities = DDB("entities")
        records = DDB("records")
        ingestion_status = DDB("ingestion_status")
        flags_table = DDB("flags_table")
    with Cluster("User Management"):
        user_role_region = DDB("user_role_region")
        role_permission = DDB("role_permission")
    with Cluster("filters"):
        filters = Lambda("filters")
        filter_contracts = Lambda("filter_contracts")
        get_list_buyers = Lambda("get_list_buyers")
        get_list_sub_category = Lambda("get_list_sub_category")
        get_list_entity = Lambda("get_list_entity")
    with Cluster("contracts"):
        get_contract_id_card = Lambda("get_contract_id_card")
        get_contracts_card = Lambda("get_contracts_card")
        get_text = Lambda("get_text")
        search = Lambda("search")
    with Cluster("flters"):
        get_list_category = Lambda("get_list_category")
    with Cluster("kpi"):
        get_kpi_entities = Lambda("get_kpi_entities")
        get_kpi_contracts = Lambda("get_kpi_contracts")
        get_kpi_contract_id = Lambda("get_kpi_contract_id")
        get_kpi_all_contract = Lambda("get_kpi_all_contract")
    with Cluster("flag"):
        flags_create = Lambda("flags_create")
        get_flags_data = Lambda("get_flags_data")
    with Cluster("support"):
        reextract_entity = Lambda("reextract_entity")
    with Cluster("tests"):
        tests_create_presigned = Lambda("tests_create_presigned")
    web_bucket >> Edge(label="") >> reverse_proxy
    clm_alb >> Edge(label="") << clm_user_pool
    clm_alb - Edge(label="default") - reverse_proxy
    clm_alb >> Edge(label="/api") << load_balancer_to_api
    clm_alb >> Edge(label="") << clm_record
    clm_user_pool - Edge(label="") - user_role_region
    clm_user_pool - Edge(label="") - role_permission
    user_role_region >> Edge(label="") >> whoami
    entities >> Edge(label="") >> filters
    entity_mapping >> Edge(label="") >> filters
    icao_customer_regions >> Edge(label="") >> filters
    entities >> Edge(label="") >> get_contract_id_card
    aircraft_family >> Edge(label="") >> get_contract_id_card
    icao_customer_regions >> Edge(label="") >> get_contract_id_card
    get_contracts_card >> Edge(label="") >> filter_contracts
    get_contracts_card >> Edge(label="") >> get_contract_id_card
    records >> Edge(label="") >> get_text
    entities >> Edge(label="") >> get_list_buyers
    icao_customer_regions >> Edge(label="") >> get_list_buyers
    entity_mapping >> Edge(label="") >> get_list_category
    entity_mapping >> Edge(label="") >> get_list_sub_category
    entity_mapping >> Edge(label="") >> get_list_entity
    entity_mapping >> Edge(label="") >> get_kpi_entities
    ingestion_status >> Edge(label="") >> get_kpi_entities
    entities >> Edge(label="") >> get_kpi_entities
    icao_customer_regions >> Edge(label="") >> get_kpi_contracts
    entity_mapping >> Edge(label="") >> get_kpi_contracts
    entities >> Edge(label="") >> get_kpi_contracts
    ingestion_status >> Edge(label="") >> get_kpi_contracts
    ingestion_status >> Edge(label="") >> get_kpi_all_contract
    icao_customer_regions >> Edge(label="") >> get_kpi_all_contract
    entities >> Edge(label="") >> search
    search >> Edge(label="") >> get_list_entity
    entity_mapping >> Edge(label="") >> search
    icao_customer_regions >> Edge(label="") >> search
    flags_table >> Edge(label="") >> search
    flags_create >> Edge(label="") >> flags_table
    config >> Edge(label="") >> tests_create_presigned
    entities >> Edge(label="") >> get_flags_data
    flags_table >> Edge(label="") >> get_flags_data
    entity_mapping >> Edge(label="") >> get_flags_data
    clm_api >> Edge(label="") >> authorizer
    clm_api >> Edge(label="/whoami") >> whoami
    clm_api >> Edge(label="/filters") >> filters
    clm_api >> Edge(label="/filters/buyer") >> get_list_buyers
    clm_api >> Edge(label="/filters/contracts") >> filter_contracts
    clm_api >> Edge(label="/filters/category") >> get_list_category
    clm_api >> Edge(label="/filters/sub_category") >> get_list_sub_category
    clm_api >> Edge(label="/filters/entity") >> get_list_entity
    clm_api >> Edge(label="/kpi/entities") >> get_kpi_entities
    clm_api >> Edge(label="/kpi/contracts") >> get_kpi_contracts
    clm_api >> Edge(label="/kpi/{contract_ID}") >> get_kpi_contract_id
    clm_api >> Edge(label="/kpi/all_contract") >> get_kpi_all_contract
    clm_api >> Edge(label="/contracts/{contract ID}/IDcard") >> get_contract_id_card
    clm_api >> Edge(label="/contracts/{contract ID}/search") >> search
    clm_api >> Edge(label="/contracts/IDcards") >> get_contracts_card
    clm_api >> Edge(label="/contracts/text/{text_uuid}") >> get_text
    clm_api >> Edge(label="/flag/entity") >> flags_create
    clm_api >> Edge(label="/tests/import") >> tests_create_presigned
    clm_api >> Edge(label="/support/reextract") >> reextract_entity
    load_balancer_to_api >> Edge(label="") << clm_api
@clayms
Copy link

clayms commented Jan 9, 2023

Try using xlabel= instead of label= in each of your Edges .

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

2 participants