skanaar / nomnoml

The sassy UML diagram renderer
https://www.nomnoml.com
MIT License
2.66k stars 208 forks source link

Custom Association Type - Crow ended arrow #185

Open tcbuzor opened 1 year ago

tcbuzor commented 1 year ago

This is more like a enhancement request or a guide on how to implement. I would like to add a crow type association for representing 1:many in ERDs. Is there an easy way to add it?

skanaar commented 1 year ago

I have been thinking about adding the crow foot type association for a long time. Nice to get an actual request!

There is some slight layouting issues that have to be resolved as the edges in nomnoml are not always perpendicular to the node borders.

Is this a good specification for crows feet?: https://vertabelo.com/blog/crow-s-foot-notation/

tcbuzor commented 1 year ago

Yes, that is a very good (standard) specification for ERD diagramming. Please see attached image for a full specification that could be implemented. I could also help out with some tasks. I must say that nomnoml is really cool and useful and would be even more useful with the support for ERD diagramming. erd_associations

tcbuzor commented 1 year ago

Daniel, do you mind describing how you intend to implement the the crow foot association or in general how the associations are rendered? Do you have a repo for the current work with layout issues?

skanaar commented 1 year ago

@tcbuzor the fact that edges could leave a node at 45° angle from a corner is actually a pretty big obstacle to implementing crow feet connectors…

not sure how to deal with that

tcbuzor commented 1 year ago

Why 45 deg angle? Do you have some time to discuss so I can understand better?

tcbuzor commented 1 year ago

See example from plantuml - } to denote crow feet (many side)

text2erd-plantuml

skanaar commented 1 year ago

For some diagrams the associations meet the nodes at 90 degrees. 90degree

But for other the associations would meet at 45 degrees (or any other angle) and maybe hit a corner like in this example: 45degree

To enable crows feet we would have to draw the edges differently, which is not supported out of the box right now.

tcbuzor commented 1 year ago

found this on mermaid: The answer I came up with was actually to join two arcs and a centre line to the centre of each entity box, and then to superimpose the opaque entity box on top, thus 'cutting' off what would otherwise look a bit like a leaf, and turning it into a crows foot intersecting with the edge of the box perfectly. This was a eureka moment for me in making it work nicely, but it is something you will have to alter to achieve your goal, otherwise every incoming relationship line will always orient towards the centre of the entity. https://github.com/mermaid-js/mermaid/issues/2751