elkjs icon indicating copy to clipboard operation
elkjs copied to clipboard

Force the positioning of a node

Open CrashLaker opened this issue 1 year ago • 3 comments

hi all, just bumped to this amazing library. thanks!

wondering if there's a way to force the position of a node.

for example i'd like to force the position of the leftmost node to the middle of the diagram

image

CrashLaker avatar Jun 12 '23 06:06 CrashLaker

Please have a look at this blogpost. TLDR: It is possible to constrain the relative position of nodes, but not the coordinates and you have to constrain all of them in some way.

soerendomroes avatar Jun 12 '23 07:06 soerendomroes

You can also set a different node placement strategy https://www.eclipse.org/elk/reference/options/org-eclipse-elk-layered-nodePlacement-strategy.html or try setting bk.fixedAlignment to BALANCED for the default BRANDES_KOEPF strategy.

soerendomroes avatar Jun 12 '23 08:06 soerendomroes

maan! awesome. thank you for the fast reply.

worked with: 'elk.layered.nodePlacement.bk.fixedAlignment': 'BALANCED',

tyty!

image

CrashLaker avatar Jun 12 '23 12:06 CrashLaker