Comments (2)
If someone ever fancy to draw flow-charts on higher genus surfaces it would also help greatly. "Mermaid.js in 3D with torus/doughnut now live!" :)
from mermaid.
Hello :)
No answer yet. I was wondering what is the algorithm used for planar drawing actually in mermaid.js.
As you can see my example does not have a K_5 or K_{3,3} minor.
But the drawing fails even on loops which no serious mathematician would consider in the beginning XD.
Maybe you could try just a simple planar graph embedding algorithm first before.
I found this recent article : https://arxiv.org/abs/1610.00130
But you would have to add a step of post-processing to fix the actual distances and positions.
If the problem on my example comes from the size of the labels, it could be solved by enlarging all the graph without enlarging the text and/or by shifting a little some text above another one (shifting is not required but would probably be more space efficient than enlarging everything.
I have looked at this also :
https://en.wikipedia.org/wiki/Force-directed_graph_drawing
But I know better the theory of graphs than the drawing of graphs.
I think it could handle the big labels in the middle of the arcs by splitting each arc in 2 and making its label a temporary vertex with a bounding box. And then a postprocessing step could redraw both parts of the original arc to make it a single curve with control points that fix its origin and source and the fact that it passes at the center of the label or at one extremity if you prefer.
It could be a choice given in the flow chart definition like :
- A -X||->|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4| B,
- A -|X|->|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4| B,
- A -||X->|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4| B,
To put the crossing point where you want and fine tune your graph drawing.
The suggested solution I gave first about Untangling planar curves could be used on top to draw non-planar graphs or if the main algorithm does not give a correct planar embedding when possible, as a "try harder" directive on named or enumerated arcs likeuntangle A --> B:1, A --> C:2
would try to untangle the first arc from A to B and the second arc from A to C in the flowchart definition.
from mermaid.
Related Issues (20)
- RenderResult should have diagram type
- Documentation versioning
- The div padding breaks mindmap rendering
- String not display completely in the mermaid on Safari when zoomed
- Allow attribute names to be escaped on ER diagram
- Duplicate configuration types
- Arrows in sequence diagrams are drawn slightly out of position
- --> on_call is not escaped? HOT 1
- Diagram proposal: N x M matrix HOT 1
- Add linebreak to task gantt
- Destroying a participant after completion of alt is not possible without extra message
- Replace HTML in XML
- '&' not rendered as expected HOT 3
- Multiple Entity codes in a row not supported in flowchart HOT 2
- gitGraph: merge commit improvment
- Flexible diagram HOT 4
- Color / properties inheritance for mindmap mermaid diagrams HOT 5
- Vertical alignment of multiline nodes incorrect when downloaded from live editor.
- Gannt: time between tasks and the actual date/time
- Sectioning of ER diagrams HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mermaid.