<!DOCTYPE html>
<html>
<head>
<title>Minimal GoJS Sample</title>
<!-- Copyright 1998-2019 by Northwoods Software Corporation. -->
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gojs/1.8.36/go.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/peity/1.2.0/jquery.peity.js"></script>
<script id="code">
function init() {
var $$ = go.GraphObject.make;
myDiagram =
$$(go.Diagram, "myDiagramDiv",
{
initialContentAlignment: go.Spot.Center, // for v1.*
layout: $$(go.TreeLayout, { angle: 90, layerSpacing: 30 }),
"undoManager.isEnabled": true
});
myDiagram.nodeTemplate =
$$(go.Node, "Vertical",
$$(go.TextBlock,
new go.Binding("text")),
$$(go.Picture,
{ width: 100, height: 50 },
new go.Binding("element", "chart", makeChart))
);
function makeChart(data) {
var span = document.createElement("span");
span.id = "peity0";
span.textContent = data.toString();
var canvases = document.getElementById("canvases");
canvases.appendChild(span);
$("#peity0").peity("line", { width: 100, height: 50 });
canvases.removeChild(span);
var canvas = $(".peity")[0];
canvases.removeChild(canvas);
return canvas;
}
myDiagram.linkTemplate =
$$(go.Link,
{ routing: go.Link.Orthogonal },
$$(go.Shape)
);
myDiagram.model = new go.GraphLinksModel(
[
{ key: 1, text: "Alpha", chart: [0, 7, 13, 11] },
{ key: 2, text: "Beta", chart: [20, 70, 130, 110] },
{ key: 3, text: "Gamma", chart: [3, 1, 4, 1, 5] },
{ key: 4, text: "Delta", chart: [123, 145, 134, 112, 132, 154, 143] }
],
[
{ 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>
<div id="canvases" style="display: none"></div>
</body>
</html>