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

Overlapping Arrow Edges in Large Entity Relationship Diagrams #5409

Open
anlai46 opened this issue Mar 24, 2024 · 1 comment
Open

Overlapping Arrow Edges in Large Entity Relationship Diagrams #5409

anlai46 opened this issue Mar 24, 2024 · 1 comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@anlai46
Copy link
Contributor

anlai46 commented Mar 24, 2024

Description

When attempting to create a large entity relationship diagram using Mermaid's live editor, I encountered an issue where the edges of arrows, which represent different cardinality ratios, overlap and collide into each other. This resulted in a messy and visually unappealing diagram, and can make it difficult to interpret the relationships between entities.

Steps to reproduce

  1. Open the Mermaid live editor
  2. Create a large entity relationship diagram with multiple entities and relationships
  3. Try including multiple different cardinality ratios between entities(one or more, zero or more, exactly one, zero or one)
  4. See how the cardinalities as arrows overlap and collide with each other, especially in denser connected areas of the diagram

Screenshots

Full ER diagram:
image

Diagram Issues:
image

Code Sample

erDiagram
    INSTRUCTOR ||--o{ COLLEGE : DEAN
    INSTRUCTOR o|--|{ SECTION : TEACHES
    INSTRUCTOR o|--|{ DEPARTMENT : EMPLOYS
    INSTRUCTOR o|--|{ DEPARTMENT : CHAIR
    INSTRUCTOR {
        string registrationNumber PK
        string make
        string model
        string[] parts
    }
    DEPARTMENT ||--|| COLLEGE : ADMINS
    DEPARTMENT ||--o{ STUDENT : HAS
    DEPARTMENT ||--o{ COURSE : OFFERS
    DEPARTMENT ||--o{ INSTRUCTOR : EMPLOYS
    DEPARTMENT ||--o{ INSTRUCTOR : CHAIR
    DEPARTMENT {
        string driversLicense PK "The license #"
        string(99) firstName "Only 99 characters are allowed"
        string lastName
        string phone UK
        int age
    }
    COLLEGE one to one INSTRUCTOR : DEAN
    COLLEGE O|--|{ DEPARTMENT : ADMINS
    COLLEGE {
        string CName 
        string COffice
        string CPhone
    }
    COURSE ||--|| SECTION : SECS
    COURSE ||--|| DEPARTMENT : OFFERS
    COURSE {
        string CName 
        string COffice
        string CPhone
    }
    SECTION ||--|| INSTRUCTOR : TEACHES
    SECTION ||--|| STUDENT : TAKES
    SECTION ||--|| COURSE : SECS
    SECTION {
        string CName 
        string COffice
        string CPhone
    }
    STUDENT ||--|| SECTION : TAKES
    STUDENT ||--|| DEPARTMENT : HAS
    STUDENT {
        string CName 
        string COffice
        string CPhone
    }

Setup

  • Mermaid version: Latest
  • Browser and Version: Chrome

Suggested Solutions

  • Look into files and modules that deal with rendering edges and nodes
  • Are there functions related to the positioning of edges relative to nodes and there calculations?(Where the space between edges are determined to prevent overlap)

Additional Context

  • I noticed the issue doesn't only occur in areas of the diagram that are more densely connected. For example in the COURSE entity there aren't as many cardinality arrows being displayed to and from that entity compared to other entities like the DEPARTMENT entity. But there is still overlap occurring there compared to the DEPARTMENT entity.
@anlai46 anlai46 added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Mar 24, 2024
@ArtjomE
Copy link

ArtjomE commented Apr 5, 2024

@anlai46 here reported issue #2291 by me might not be the same, but in my opinion, still lead to the same overlapping issue in displaying the arrows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

2 participants