How to use the go.TreeLayout and can manually change the node location based on the node location data
myDiagram = $(go.Diagram, eleID, {
"initialContentAlignment": go.Spot.Center,
//initialAutoScale: go.Diagram.Uniform,
initialDocumentSpot: go.Spot.Center,
initialViewportSpot: go.Spot.Center,
"toolManager.mouseWheelBehavior": go.ToolManager.WheelZoom,
minScale: 0.25,
grid: $(go.Panel, "Grid",
$(go.Shape, "LineH", { stroke: "#b5b5b6", strokeWidth: .5 }),
$(go.Shape, "LineH", { stroke: "#b5b5b6", strokeWidth: 1.5, interval: 10 }),
$(go.Shape, "LineV", { stroke: "#b5b5b6", strokeWidth: .5 }),
$(go.Shape, "LineV", { stroke: "#b5b5b6", strokeWidth: 1.5, interval: 10 })
),
//"draggingTool.isGridSnapEnabled": true,
initialScale:0.4,
maxScale: 6, //最大视图的放大比例
hasHorizontalScrollbar: false, //纵向滚动条隐藏
hasVerticalScrollbar: false, //横向滚动条隐藏
contentAlignment: go.Spot.Center, //图形居中
padding: 500, //内边距
"ModelChanged": changeModel,//新增事件
layout: $(go.TreeLayout, { isInitial: false, isOngoing: false } ),
"InitialLayoutCompleted": function(e) {
// if not all Nodes have real locations, force a layout to happen
if (!e.diagram.nodes.all(function(n) { return n.location.isReal(); })) {
e.diagram.layoutDiagram(true);
}
}
});
by the way
How to record the bend position of the connection line on the data carrier and When loading, you can save the position and bend points of the connection line?
Thanks walter