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

flowchart rendering issues #45

Closed
asknet opened this issue Dec 19, 2023 · 2 comments · Fixed by #61
Closed

flowchart rendering issues #45

asknet opened this issue Dec 19, 2023 · 2 comments · Fixed by #61
Labels
bug Something isn't working

Comments

@asknet
Copy link

asknet commented Dec 19, 2023

for the below flowchart example:

Two primary issues have been identified in the Excalidraw output of the Mermaid flowchart:

  1. Multiple Relationships Rendering Issue: When multiple relationships are directed towards a single entity, the Excalidraw output fails to render these relationships as separate entities. This issue particularly affects the entity 17 in the example.
  2. HTML Formatting in Entity Label Not Rendered: The HTML formatting included in the entity labels is not being rendered in the Excalidraw output. Instead of formatted text, the raw HTML code is displayed.

Steps to Reproduce:

  • Open the application and navigate to the Mermaid flowchart rendering section.
  • Input the provided Mermaid flowchart code.
  • Generate the Excalidraw output for the flowchart.
  • Observe the output, focusing on the entity with multiple relationships and any entity labels with HTML formatting.

Expected Result:

  • Each relationship towards a single entity should be distinctly rendered in the Excalidraw output.
  • HTML formatting in entity labels should be correctly rendered, displaying formatted text as intended.

Actual Result:

  • The Excalidraw output merges multiple relationships to a single entity into one, causing a loss of detail and clarity in the diagram.
  • Entity labels with HTML formatting display the raw HTML code instead of the formatted text.

Severity: Medium
The issue with rendering multiple relationships can lead to a loss of crucial information and misinterpretation of the diagram.
The HTML formatting issue affects the readability and professional presentation of the diagram but does not impede the understanding of the relationships.

example

%%{init: {'theme':'forest'}}%%
flowchart LR
 style Entity1 fill: gold, stroke:#333, stroke-width:4px

Entity1[Entity 1]
Entity2[Entity 2 fa:fa-suitcase]
Entity3[Entity 3 fa:fa-suitcase]
Entity4[Entity 4]
Entity5[Entity 5]
Entity6[Entity 6<br><sub>Entity6</sub>]
Entity7[Entity 7]

Entity2 -..->|Relation1| Entity1
Entity3 -..->|Relation2| Entity1
Entity4 -..->|Relation3| Entity1
Entity3 -..->|Relation4| Entity1
Entity5 -..->|Relation5| Entity1
Entity5 -..->|Relation6| Entity1
Entity6 -..->|Relation7| Entity1
Entity7 -..->|Relation8| Entity1

Entity8[Entity 8<br><sub>Entity8</sub>]
Entity1[Entity 1]
Entity9[Entity 9<br><sub>Entity9</sub>]
Entity10[Entity 10]
Entity4[Entity 4]
Entity11[Entity 11]
Entity12[Entity 12]
Entity13[Entity 13<br><sub>Entity13</sub>]
Entity14[Entity 14]
Entity15[Entity 15]
Entity16[Entity 16 fa:fa-suitcase]
Entity17[Entity 17 fa:fa-suitcase]
Entity18[Entity 18 fa:fa-suitcase]
Entity19[Entity 19 fa:fa-suitcase]

Entity1 -..->|Relation9| Entity8
Entity1 -..->|Relation10| Entity9
Entity1 -..->|Relation11| Entity10
Entity1 -..->|Relation12| Entity4
Entity1 ===>|fa:fa-link Relation13| Entity11
Entity1 -..->|Relation14| Entity12
Entity1 -..->|Relation15| Entity13
Entity1 -..->|Relation16| Entity14
Entity1 ===>|fa:fa-link Relation17| Entity15
Entity1 -..->|Relation18| Entity16
Entity1 -..->|Relation19| Entity17
Entity1 -..->|Relation20| Entity17
Entity1 -..->|Relation21| Entity17
Entity1 -..->|Relation22| Entity18
Entity1 -..->|Relation23| Entity19

@asknet
Copy link
Author

asknet commented Dec 21, 2023

@ad1992 another rendering issue.

Issues:

  1. Arrows aren't similarly curved as in mermaid
  2. When an element style is mentioned as 0px, renderer still renders with default size.

example mermaid flowchart

%%{init: {'theme':'forest'}}%%
flowchart LR
 style Entity1 fill: gold, stroke:#333, stroke-width:4px

subgraph Legend
    direction LR
    start1[ ] -.->|Lookup Relationship| stop1[ ]
    style start1 height:0px;
    style stop1 height:0px;
    start2[ ] ==>|Master-Detail Relationship| stop2[ ]
    style start2 height:0px;
    style stop2 height:0px; 
    A -.->|A is parent of B| B
    style A height:0px;
    style B height:0px; 
end

Entity1[Entity 1]
Entity2[Entity 2]
Entity3[Entity 3]

Entity2 ===>|fa:fa-link Relation1| Entity1
Entity3 -..->|Relation2| Entity1

Entity4[Entity 4]
Entity3[Entity 3]
Entity5[Entity 5 fa:fa-suitcase]
Entity6[Entity 6 fa:fa-suitcase<br><sub>Entity6</sub>]

Entity3 ===>|fa:fa-link Relation3| Entity4
Entity5 -..->|Relation4| Entity4
Entity6 -..->|Relation5| Entity4
Entity4 -..->|Relation6| Entity4

igorwessel added a commit to igorwessel/mermaid-to-excalidraw that referenced this issue May 6, 2024
@ad1992 ad1992 added the bug Something isn't working label May 7, 2024
ad1992 added a commit that referenced this issue May 16, 2024
* feat(utils): enhance computeEdgePositions to maintain direction points

This commit modifies the computeEdgePositions function in utils.ts to keep points that are on a straight line in the same direction.
The filter condition is updated to only remove points that have both the same x and y coordinates as the previous point.
This ensures that points on a straight line in the same direction are maintained.

* fix(flowchart): handle cases when not all edges are retrieved in flowchart.ts

* chore: add #45 issue testcase

* add function closure for processed edges instead of passing as param

* working in solution

* possible limit

* test: add testcases for remove second last point

* fix: add a map to count repeated edges

* tweaks and improvements

* fix tests

---------

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
@asknet
Copy link
Author

asknet commented May 20, 2024

Thank you for fixing this. Will there be a plan to fix the rendering of HTML?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants