diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 8aabce71b..69d8d918d 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -39,6 +39,7 @@ func NewGraph(ast *d2ast.Map) *Graph { Parent: nil, Children: make(map[string]*Object), } + d.Root.Attributes.Direction.Value = "down" return d } diff --git a/e2etests/testdata/sanity/1_to_2/elk/board.exp.json b/e2etests/testdata/sanity/1_to_2/elk/board.exp.json index c1d27b8de..6c709942a 100644 --- a/e2etests/testdata/sanity/1_to_2/elk/board.exp.json +++ b/e2etests/testdata/sanity/1_to_2/elk/board.exp.json @@ -5,8 +5,8 @@ "id": "a", "type": "", "pos": { - "x": 12, - "y": 33 + "x": 31, + "y": 12 }, "width": 113, "height": 126, @@ -43,8 +43,8 @@ "id": "b", "type": "", "pos": { - "x": 225, - "y": 12 + "x": 12, + "y": 238 }, "width": 113, "height": 126, @@ -81,8 +81,8 @@ "id": "c", "type": "", "pos": { - "x": 225, - "y": 158 + "x": 145, + "y": 238 }, "width": 113, "height": 126, @@ -143,12 +143,12 @@ "labelPercentage": 0, "route": [ { - "x": 125, - "y": 75 + "x": 68.5, + "y": 138 }, { - "x": 225, - "y": 75 + "x": 68.5, + "y": 238 } ], "animated": false, @@ -181,20 +181,20 @@ "labelPercentage": 0, "route": [ { - "x": 125, - "y": 117 + "x": 106.16666666666667, + "y": 138 }, { - "x": 175, - "y": 117 + "x": 106.16666666666667, + "y": 188 }, { - "x": 175, - "y": 221 + "x": 201.5, + "y": 188 }, { - "x": 225, - "y": 221 + "x": 201.5, + "y": 238 } ], "animated": false, diff --git a/e2etests/testdata/sanity/1_to_2/elk/sketch.exp.svg b/e2etests/testdata/sanity/1_to_2/elk/sketch.exp.svg index 76640f7f2..c6a7e3671 100644 --- a/e2etests/testdata/sanity/1_to_2/elk/sketch.exp.svg +++ b/e2etests/testdata/sanity/1_to_2/elk/sketch.exp.svg @@ -2,7 +2,7 @@ // RegisterHash registers a function that returns a new instance of the given // hash function. This is intended to be called from the init function in // packages that implement hash functions. func RegisterHash(h Hash, f func() hash.Hash) { @@ -22,7 +22,7 @@ width="1382" height="366" viewBox="-88 -88 1382 366">        panic("crypto: RegisterHash of unknown hash function")     }     hashes[h] = f -}xy acfbdhg agdfbhec abcdefghijklmnopq finallyatreeandnodessomemoremanythenhereyouhavehierarchyanotherofnestingtreesatreeinsidehierarchyroot bacde21345abcde alphabeta - - -gammaab aabbccddllffwwyynniijjkkssuurmeemmmmgghhzzooppqqrrttvvxxabac - - -1 - - -2 - - -3 - - -4 - - -5 - - -6abcdefghiqrjmnoszaabbeeffggklptuwxyccddv abcdefghijklmnopqrstuvw abcdefghijklmnopqrstu acdefgbh topabcbottomstartend usersid -int -name -string -email -string -password -string -last_login -datetime -productsid -int -price -decimal -sku -string -name -string -ordersid -int -user_id -int -product_id -int -shipmentsid -int -order_id +usersid +int +name +string +email +string +password +string +last_login +datetime +productsid +int +price +decimal +sku +string +name +string +ordersid +int +user_id +int +product_id +int +shipmentsid int -tracking_number -string -status +order_id +int +tracking_number string - rectanglesquare acbl1l2c1l2c3l2c2l3c1l3c2l4bacacbabcc1c2c3abc AKHIALFLGAMSTNAZCANVNMUTARLAMOOKTXORCOKSNEWYCTMANYRIDEMDNJPANCSCIDMTWAILINIAMIKYWIOHMNSDVAWVMENHVTNDcontainerfirstsecond - - -1->2 - - -c->2