microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.35k stars 302 forks source link

How to set new position for a Node #285

Closed NiklasVJM closed 3 years ago

NiklasVJM commented 3 years ago

Hi!

I was trying this tool out, since it looks very promising to what I try to do.

How can I set new position (with X and Y coordinates) to new Node? I need to place nodes into very precise points on this "canvas" and then let this tool do all the routing.

For example, if I have:

mainGraph.AddNode(new Node("T")); Then, how can I set new absolute X,Y -coordinate for this? I tried with: mainGraph.FindNode("T").GeometryNode.Center = new Point(10, 10); but nothing happens. Even after I call: viewer.Invalidate();. Can you please help me with this? A Code example would be awesome! Thanks!

levnach commented 3 years ago

I created an example : PopulateGViwerWithPrecalculatedDrawingGraph.csproj. Hope it helps.

NiklasVJM commented 3 years ago

Thank you so much you absolute legend! I will give this a go later, and see how it goes.

Again thank you for your time!