Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Autolayout difference when using GraphLinksModel

$
0
0

@robinvanbrakel wrote:

Hi There, First of all thanks for this amazing plugin, GoJS fits our needs perfectly.

I have one question regarding layouting and the different models.

First we loaded our model using:
this.diagram.model = go.Model.fromJson(result);

And we use layout settings:
this.diagram.layout = $(go.LayeredDigraphLayout, {
direction: 90,
layerSpacing: 40,
columnSpacing: 100,
setsPortSpots: false
});

This gave us the layout result we wanted:

Now I want to add nodes and links programatically, so far I know the best way to do this is using the GraphLinksModel. so I changed the loading of our model to:
this.diagram.model = new go.GraphLinksModel(result.nodeDataArray, result.linkDataArray);

And with the same layout settings I get a totally different layout, is there any way to get back to the old layout result?

This is the new and wrong layout result:

Is there any way to the GraphLinksModel and still get the same result as the first on in this post?
Or is there a way to easily add links, nodes and relink links programitically using the go.Model.fromJson function?

Thanks in advance!

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles