Set data to model ,TreeLayout will modify loc property of node

i use tree layout,when i set data to model,it will modify the loc properties of nodes.

before data:

{ “class”: “go.GraphLinksModel”,
“linkFromPortIdProperty”: “fromPort”,
“linkToPortIdProperty”: “toPort”,
“nodeDataArray”: [
{“key”:“From1”, “category”:“OPS_SQL”, “text”:“test11111111111111111111111111111111”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“lightblue”, “loc”:“437.9999999999999 397.5”, “location”:{“class”:“go.Point”, “x”:437.9999999999999, “y”:397.5}},
{“key”:“From2”, “category”:“OPS_SQL”, “text”:“test2”, “taskInfo”:{“carryStyle”:“test”, “level”:2}, “color”:“pink”, “loc”:“65 212.5”, “location”:{“class”:“go.Point”, “x”:65, “y”:212.50000000000009}},
{“key”:“From3”, “category”:“OPS_SQL”, “text”:“test2”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“pink”, “loc”:“355 22.5”, “location”:{“class”:“go.Point”, “x”:355.00000000000017, “y”:22.5}},
{“key”:“From4”, “category”:“OPS_SQL”, “text”:“test2”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“pink”, “loc”:“495 22.5”, “location”:{“class”:“go.Point”, “x”:495, “y”:22.5}},
{“key”:“From5”, “category”:“OPS_SQL”, “text”:“test2”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“pink”, “loc”:“635 22.5”, “location”:{“class”:“go.Point”, “x”:634.9999999999999, “y”:22.5}},
{“key”:“To1”, “category”:“OPS_SQL”, “text”:“test3”, “taskInfo”:{“carryStyle”:“test”, “level”:1}, “color”:“pink”, “loc”:“65 117.5”, “location”:{“class”:“go.Point”, “x”:65, “y”:117.49999999999999}},
{“key”:“To2”, “category”:“OPS_SQL”, “text”:“test4”, “taskInfo”:{“carryStyle”:“test”, “level”:1}, “color”:“pink”, “loc”:“215 117.5”, “location”:{“class”:“go.Point”, “x”:214.99999999999994, “y”:117.49999999999999}},
{“key”:“To3”, “category”:“OPS_SQL”, “text”:“test4”, “taskInfo”:{“carryStyle”:“test”, “level”:3}, “color”:“pink”, “loc”:“65 307.5”, “location”:{“class”:“go.Point”, “x”:65, “y”:307.49999999999994}},
{“key”:“To4”, “category”:“OPS_SQL”, “text”:“test4”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“pink”, “loc”:“775 22.5”, “location”:{“class”:“go.Point”, “x”:774.9999999999995, “y”:22.5}},
{“key”:“To5”, “category”:“OPS_SQL”, “text”:“test4”, “taskInfo”:{“carryStyle”:“test”, “level”:1}, “color”:“pink”, “loc”:“495 117.5”, “location”:{“class”:“go.Point”, “x”:495, “y”:117.49999999999999}}
],
“linkDataArray”: [
{“from”:“From1”, “to”:“To1”, “fromPort”:“B”, “toPort”:“T”, “points”:[438,420,438,430,438,430,364,430,364,84,65,84,65,85,65,95]},
{“from”:“From1”, “to”:“To2”, “fromPort”:“B”, “toPort”:“T”, “points”:[438,420,438,430,326.5,430,326.5,85,215,85,215,95]},
{“from”:“From2”, “to”:“To3”, “fromPort”:“B”, “toPort”:“T”, “points”:[65,235,65,245,65,260,65,260,65,275,65,285]},
{“from”:“From4”, “to”:“To5”, “fromPort”:“B”, “toPort”:“T”, “points”:[495,45,495,55,495,70,495,70,495,85,495,95]},
{“from”:“To5”, “to”:“To3”, “fromPort”:“B”, “toPort”:“T”, “points”:[495,140,495,150,495,148,495,148,495,244,65,244,65,275,65,285]},
{“from”:“To1”, “to”:“From2”, “fromPort”:“B”, “toPort”:“T”, “points”:[65,140,65,150,65,165,65,165,65,180,65,190]},
{“from”:“To2”, “to”:“From2”, “fromPort”:“B”, “toPort”:“T”, “points”:[215,140,215,150,215,165,65,165,65,180,65,190]}
]}

after data:

{ “class”: “go.GraphLinksModel”,
“linkFromPortIdProperty”: “fromPort”,
“linkToPortIdProperty”: “toPort”,
“nodeDataArray”: [
{“key”:“From1”, “category”:“OPS_SQL”, “text”:“test11111111111111111111111111111111”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“lightblue”, “loc”:“140 22.5”, “location”:{“class”:“go.Point”, “x”:140.00000000000003, “y”:22.5}},
{“key”:“From2”, “category”:“OPS_SQL”, “text”:“test2”, “taskInfo”:{“carryStyle”:“test”, “level”:2}, “color”:“pink”, “loc”:“65 212.5”, “location”:{“class”:“go.Point”, “x”:65, “y”:212.50000000000006}},
{“key”:“From3”, “category”:“OPS_SQL”, “text”:“test2”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“pink”, “loc”:“355 22.5”, “location”:{“class”:“go.Point”, “x”:354.99999999999994, “y”:22.5}},
{“key”:“From4”, “category”:“OPS_SQL”, “text”:“test2”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“pink”, “loc”:“495 22.5”, “location”:{“class”:“go.Point”, “x”:495, “y”:22.5}},
{“key”:“From5”, “category”:“OPS_SQL”, “text”:“test2”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“pink”, “loc”:“635 22.5”, “location”:{“class”:“go.Point”, “x”:635.0000000000005, “y”:22.5}},
{“key”:“To1”, “category”:“OPS_SQL”, “text”:“test3”, “taskInfo”:{“carryStyle”:“test”, “level”:1}, “color”:“pink”, “loc”:“65 117.5”, “location”:{“class”:“go.Point”, “x”:65, “y”:117.50000000000003}},
{“key”:“To2”, “category”:“OPS_SQL”, “text”:“test4”, “taskInfo”:{“carryStyle”:“test”, “level”:1}, “color”:“pink”, “loc”:“215 117.5”, “location”:{“class”:“go.Point”, “x”:215.00000000000003, “y”:117.50000000000003}},
{“key”:“To3”, “category”:“OPS_SQL”, “text”:“test4”, “taskInfo”:{“carryStyle”:“test”, “level”:3}, “color”:“pink”, “loc”:“65 307.5”, “location”:{“class”:“go.Point”, “x”:65, “y”:307.5000000000002}},
{“key”:“To4”, “category”:“OPS_SQL”, “text”:“test4”, “taskInfo”:{“carryStyle”:“test”, “level”:0}, “color”:“pink”, “loc”:“775 22.5”, “location”:{“class”:“go.Point”, “x”:775.0000000000002, “y”:22.5}},
{“key”:“To5”, “category”:“OPS_SQL”, “text”:“test4”, “taskInfo”:{“carryStyle”:“test”, “level”:1}, “color”:“pink”, “loc”:“495 117.5”, “location”:{“class”:“go.Point”, “x”:494.99999999999994, “y”:117.50000000000003}}
],
“linkDataArray”: [
{“from”:“From1”, “to”:“To1”, “fromPort”:“B”, “toPort”:“T”, “points”:[438,420,438,430,438,430,364,430,364,84,65,84,65,85,65,95]},
{“from”:“From1”, “to”:“To2”, “fromPort”:“B”, “toPort”:“T”, “points”:[438,420,438,430,326.5,430,326.5,85,215,85,215,95]},
{“from”:“From2”, “to”:“To3”, “fromPort”:“B”, “toPort”:“T”, “points”:[65,235,65,245,65,260,65,260,65,275,65,285]},
{“from”:“From4”, “to”:“To5”, “fromPort”:“B”, “toPort”:“T”, “points”:[495,45,495,55,495,70,495,70,495,85,495,95]},
{“from”:“To5”, “to”:“To3”, “fromPort”:“B”, “toPort”:“T”, “points”:[495,140,495,150,495,148,495,148,495,244,65,244,65,275,65,285]},
{“from”:“To1”, “to”:“From2”, “fromPort”:“B”, “toPort”:“T”, “points”:[65,140,65,150,65,165,65,165,65,180,65,190]},
{“from”:“To2”, “to”:“From2”, “fromPort”:“B”, “toPort”:“T”, “points”:[215,140,215,150,215,165,65,165,65,180,65,190]}
]}

TreeLayout config:ayout:
$go(go.TreeLayout, {angle: 90,arrangement:go.TreeLayout.ArrangementHorizontal,comparer: go.LayoutVertex.smartComparer,isOngoing:false,isValidLayout:false }),

Yes, the normal behavior when the Diagram.model is replaced is to perform the Diagram.layout. You can disable that by setting Layout.isInitial to false. Read http://gojs.net/latest/intro/layouts.html, the section about layout invalidation.

Setting Layout.isValidLayout to false does not help avoid an initial layout.

@walter Hi .Now, i have secound problem: i set isInitial and isOngoing to false, and i want to layout diagram .So, i use layoutDiagram(true) method.
But when using the layoutDiagram menthod ,the diagram model data can’t sync. Do you have good solution.

What do you mean by “can’t sync”? Any TwoWay Bindings on Node.location or Node.position should update the model data source property.

Are you using the debug library and checking for warnings or errors?

The question had solved. Because i forgot add makeTwoWay to node .Thank you very much @walter