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

Line Order Adjustment in Mermaid Diagrams #6431

Open
aCoo4ie opened this issue Mar 28, 2025 · 0 comments
Open

Line Order Adjustment in Mermaid Diagrams #6431

aCoo4ie opened this issue Mar 28, 2025 · 0 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@aCoo4ie
Copy link

aCoo4ie commented Mar 28, 2025

Proposal

Mermaid.js should provide a way to visualize or adjust the order of lines in the diagram.

Example

Current Mermaid code:

graph TD
  subgraph test
  1-->2
  7-->1
  3-->7
  6-->7
  2-->3
  4-->5
  3-->4
  end

This results in overlapping lines that are hard to adjust.However, when the number of lines in the diagram is relatively large, there will be overlapping, which affects the view, and it is difficult to adjust the order of the lines.
I suggest adding an option or method to adjust the line rendering order more easily.

Alternative solution using subgraph:

graph TD
  <1>7-->1
  <2>1-->2
  <3>2-->3
  3-->4
  3-->7
  4-->5
  6-->7
 end

Screenshots

For example, with the following Mermaid code, it's hard to easily move the leftmost line to the right, as shown in test1 below:

graph TD
    subgraph test
    1-->2
    7-->1
    3-->7
    6-->7
    2-->3
    4-->5
    3-->4
    end

Image

Eventually, using a subgraph approach is the only workaround that somewhat matches the expectation, as shown in test2 below:

graph TD
    subgraph test
        subgraph left
            7
            1
        end
        subgraph right
            2
            3
            4
            5
            6
        end
        7-->1
        1-->2
        2-->3
        3-->4
        3-->7
        4-->5
        6-->7
    end

Image

@aCoo4ie aCoo4ie added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Mar 28, 2025
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: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant