SOURCE

console 命令行工具 X clear

                    
>
console
var $ = go.GraphObject.make; // 构造方法

var myDiagram = $(go.Diagram, 
    "myDiagramDiv5",
    {
        'undoManager.isEnabled': true, // 是否可以消除
        'clickCreatingTool.archetypeNodeData': {
            text: 'new node',
            color: 'lightblue',
        },
        model: $(go.GraphLinksModel, 
            {
                linkKeyProperty: 'key',
                nodeDataArray: [
                    { key: 0, text: 'Alpha', color: 'lightblue', loc: '0 0' },
                    { key: 1, text: 'Beta', color: 'orange', loc: '150 0' },
                    { key: 2, text: 'Gamma', color: 'lightgreen', loc: '0 150' },
                    { key: 3, text: 'Delta', color: 'pink', loc: '150 150' },
                ],
                linkDataArray: [
                    { key: -1, from: 0, to: 1 },
                    { key: -2, from: 0, to: 2 },
                    { key: -3, from: 1, to: 1 },
                    { key: -4, from: 2, to: 3 },
                    { key: -5, from: 3, to: 0 },
                ]
            }
        ),
        nodeTemplate: $(go.Node,
            'Auto',
            new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(
                go.Point.stringify,
            ),
            $(
                go.Shape,
                'RoundedRectangle',
                { name: 'SHAPE', fill: 'white', strokeWidth: 0 },
                new go.Binding('fill', 'color'),
            ),
            $(
                go.TextBlock,
                { margin: 8, editable: true },
                new go.Binding('text').makeTwoWay(),
            ),
        )
    }
)
<div id="myDiagramDiv5" style="width:700px;height:800px;"></div>
#myDiagramDiv5 {
	background-color: #F8F8F8;
	border: 1px solid #aaa;
}

本项目引用的自定义外部资源