BurntSushi / erd

Translates a plain text description of a relational database schema to a graphical entity-relationship diagram.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changing visulization of relationship between entities

Anupriya014 opened this issue · comments

Hello @BurntSushi & @echeon !

I was just wondering is there any way to change the dotted line connecting entities to ungapped line with 'head' and 'tail' ?
To understand the complete script is difficult for me & hence, I am unable to edit it..
Please help me out.

Thank you in advance. :)

@Anupriya014 There is added support now to change the style of line (-e in command-line).

I think -e controls the shape of the lines, not their style and head/tail.

To make the line solid, you'd have to change A.Dashed here to Solid or one of the values from this list.

And to use "crow's foot"-styled arrow heads/tails instead of the labels, I came up with this:

      let label = A.Label $ A.HtmlLabel $ H.Text $ withLabelFmt " %s " opts []
-     edge (entity1 r) (entity2 r) [label, l1, l2]
+     let (arrTail, arrHead) = (A.ArrowTail $ crowfoot $ card1 r,
+                               A.ArrowHead $ crowfoot $ card2 r)
+     edge (entity1 r) (entity2 r) [label,  A.Dir Both, arrHead, arrTail]  
+ 
+ crowfoot :: Cardinality -> A.ArrowType
+ crowfoot ZeroOne  = A.AType [(A.openMod, A.DotArrow), (A.noMods, A.Tee)]  -- odottee
+ crowfoot One      = A.AType [(A.noMods, A.Tee), (A.noMods, A.Tee)]        -- teetee
+ crowfoot ZeroPlus = A.AType [(A.noMods, A.Crow), (A.openMod, A.DotArrow)] -- crowodot
+ crowfoot OnePlus  = A.AType [(A.noMods, A.Crow), (A.noMods, A.Tee)]       -- crowtee