<!DOCTYPE html>
<html>
<head>
<title>Minimal GoJS Sample</title>
<!-- Copyright 1998-2021 by Northwoods Software Corporation. -->
<script src="go.js"></script>
<script id="code">
function init() {
var $ = go.GraphObject.make;
myDiagram =
$(go.Diagram, "myDiagramDiv",
{
layout: $(go.LayeredDigraphLayout, { isRealtime: false }),
"undoManager.isEnabled": true
});
myDiagram.nodeTemplate =
$(go.Node, "Auto",
{ locationSpot: go.Spot.Center },
$(go.Shape,
{ fill: "white", portId: "" },
new go.Binding("fill", "color")),
$(go.TextBlock,
{ margin: 8, editable: true },
new go.Binding("text").makeTwoWay())
);
myDiagram.groupTemplate =
$(go.Group, "Auto",
{
layout:
$(go.CircularLayout,
{ aspectRatio: 0.62, spacing: 20, startAngle: 210 })
},
$(go.Shape, "Ellipse",
{
stretch: go.GraphObject.Fill,
margin: new go.Margin(10, 10),
spot1: go.Spot.TopLeft,
spot2: go.Spot.BottomRight,
fill: "transparent", stroke: "green", strokeWidth: 2,
portId: ""
}),
$(go.Placeholder)
);
myDiagram.model = new go.GraphLinksModel(
[
{ key: 1, text: "Alpha", color: "lightblue" },
{ key: 2, text: "Beta", color: "orange" },
{ key: 3, text: "Gamma", color: "lightgreen", isGroup: true },
{ key: 4, text: "Delta", color: "pink" },
{ group: 3, text: "A" },
{ group: 3, text: "BBBB" },
{ group: 3, text: "CCCC" },
{ group: 3, text: "DDD" },
{ group: 3, text: "EEE" },
],
[
{ from: 1, to: 2 },
{ from: 1, to: 3 },
{ from: 3, to: 4 },
]);
}
</script>
</head>
<body onload="init()">
<div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:600px"></div>
</body>
</html>