mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
39.23k stars 2.52k forks source link

Edge label position #890

Open mamatkasym opened 1 year ago

mamatkasym commented 1 year ago

Some edge labels are placed perfect like edge [1] in the following diagram. Some edge labels cover the edges like edge [10] in the following diagram. Some edge labels are placed far from the edges like edge [4] in the following diagram.

Diagram: list_transactions_process

Code:

from diagrams import Diagram, Edge
from diagrams.aws.analytics import ElasticsearchService
from diagrams.aws.compute import Lambda
from diagrams.aws.integration import Appsync
from diagrams.aws.network import APIGateway

with Diagram("List transactions process", show=False):
    appSyncClient = Appsync("GraphQL")
    lambdaAverspay = Lambda("listPayments")
    paymentGateway = APIGateway("/payments")
    lambdaPaymentsGateway = Lambda("listTransaction")
    authorizationGateway = APIGateway("/token")
    authorizeRequestEdge = Edge(label="[2]", color='darkgreen')
    authorizeResponseEdge = Edge(label="[3]", color='darkgreen')
    opensearch = ElasticsearchService("Open Search")

    lambdaAverspay << authorizeRequestEdge << authorizationGateway << authorizeResponseEdge << lambdaAverspay
    appSyncClient << Edge(label="[1]") << lambdaAverspay
    lambdaAverspay << Edge(label="[10]") << appSyncClient
    lambdaAverspay << Edge(label="[4]") << paymentGateway << Edge(label="[9]") << lambdaAverspay
    paymentGateway << Edge(label="[5]") << lambdaPaymentsGateway << Edge(label="[8]") << paymentGateway
    lambdaPaymentsGateway >> Edge(label="[6]") >> opensearch >> Edge(label="[7]") >> lambdaPaymentsGateway
techie2000 commented 11 months ago

Having recently started looking to see if I can use to better document some of my personal efforts, case [4] has been causing me a fair amount of grief so I'll watch this issue for updates. Hopefully it's just an optional parameter I've not found so far :)