UNPKG

24.1 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4<meta charset="utf-8"/>
5<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover"/>
6
7<link rel="stylesheet" href="../assets/css/style.css"/>
8<!-- Copyright 1998-2021 by Northwoods Software Corporation. --> <title> GoJS Ports in Nodes-- Northwoods Software </title>
9 <link rel="stylesheet" href="../assets/css/prism.css" />
10 </head>
11 <script>
12
13 window.diagrams = [];
14 window.goCode = function(pre, w, h, parentid, animation) {
15 window.diagrams.push([pre, w, h, parentid, animation]);
16 }
17 </script>
18 <body>
19 <nav id="navTop" class="w-full z-30 top-0 text-white bg-nwoods-primary">
20 <div class="w-full container max-w-screen-lg mx-auto flex flex-wrap sm:flex-nowrap items-center justify-between mt-0 py-2">
21 <div class="md:pl-4">
22 <a class="text-white hover:text-white no-underline hover:no-underline
23 font-bold text-2xl lg:text-4xl rounded-lg hover:bg-nwoods-secondary " href="../">
24 <h1 class="mb-0 p-1 ">GoJS</h1>
25 </a>
26 </div>
27 <button id="topnavButton" class="rounded-lg sm:hidden focus:outline-none focus:ring" aria-label="Navigation">
28 <svg fill="currentColor" viewBox="0 0 20 20" class="w-6 h-6">
29 <path id="topnavOpen" fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM9 15a1 1 0 011-1h6a1 1 0 110 2h-6a1 1 0 01-1-1z" clip-rule="evenodd"></path>
30 <path id="topnavClosed" class="hidden" fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
31 </svg>
32 </button>
33 <div id="topnavList" class="hidden sm:block items-center w-auto mt-0 text-white p-0 z-20">
34 <ul class="list-reset list-none font-semibold flex justify-end flex-wrap sm:flex-nowrap items-center px-0 pb-0">
35 <li class="p-1 sm:p-0"><a class="topnav-link" href="../learn/">Learn</a></li>
36 <li class="p-1 sm:p-0"><a class="topnav-link" href="../samples/">Samples</a></li>
37 <li class="p-1 sm:p-0"><a class="topnav-link" href="../intro/">Intro</a></li>
38 <li class="p-1 sm:p-0"><a class="topnav-link" href="../api/">API</a></li>
39 <li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/products/register.html">Register</a></li>
40 <li class="p-1 sm:p-0"><a class="topnav-link" href="../download.html">Download</a></li>
41 <li class="p-1 sm:p-0"><a class="topnav-link" href="https://forum.nwoods.com/c/gojs/11">Forum</a></li>
42 <li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/contact.html"
43 target="_blank" rel="noopener" onclick="getOutboundLink('https://www.nwoods.com/contact.html', 'contact');">Contact</a></li>
44 <li class="p-1 sm:p-0"><a class="topnav-link" href="https://www.nwoods.com/sales/index.html"
45 target="_blank" rel="noopener" onclick="getOutboundLink('https://www.nwoods.com/sales/index.html', 'buy');">Buy</a></li>
46 </ul>
47 </div>
48 </div>
49 <hr class="border-b border-gray-600 opacity-50 my-0 py-0" />
50 </nav>
51
52 <div class="md:flex flex-col md:flex-row md:min-h-screen w-full max-w-screen-xl mx-auto">
53
54 <div id="navSide" class="flex flex-col w-full md:w-40 lg:w-48 text-gray-700 bg-white flex-shrink-0">
55 <div class="flex-shrink-0 px-8 py-4">
56 <button id="navButton" class="rounded-lg md:hidden focus:outline-none focus:ring" aria-label="Navigation">
57 <svg fill="currentColor" viewBox="0 0 20 20" class="w-6 h-6">
58 <path id="navOpen" fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM9 15a1 1 0 011-1h6a1 1 0 110 2h-6a1 1 0 01-1-1z" clip-rule="evenodd"></path>
59 <path id="navClosed" class="hidden" fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
60 </svg>
61 </button>
62 </div>
63 <nav id="navList" class="min-h-screen hidden md:block sidebar-nav flex-grow px-1 lg:px-4 pb-4 md:pb-0 md:overflow-y-auto break-words">
64 <a href="index.html">Basics</a>
65 <a href="buildingObjects.html">Building Parts</a>
66 <a href="usingModels.html">Using Models</a>
67 <a href="dataBinding.html">Data Binding</a>
68 <a href="react.html">GoJS with React</a>
69 <a href="angular.html">GoJS with Angular</a>
70 <a href="textBlocks.html">TextBlocks</a>
71 <a href="shapes.html">Shapes</a>
72 <a href="pictures.html">Pictures</a>
73 <a href="panels.html">Panels</a>
74 <a href="tablePanels.html">Table Panels</a>
75 <a href="brush.html">Brushes</a>
76 <a href="sizing.html">Sizing Objects</a>
77 <a href="itemArrays.html">Item Arrays</a>
78 <a href="changedEvents.html">Changed Events</a>
79 <a href="transactions.html">Transactions</a>
80 <a href="viewport.html">Coordinates</a>
81 <a href="initialView.html">Initial View</a>
82 <a href="collections.html">Collections</a>
83 <a href="links.html">Links</a>
84 <a href="linkLabels.html">Link Labels</a>
85 <a href="connectionPoints.html">Link Points</a>
86 <a href="ports.html">Ports</a>
87 <a href="nodes.html">Nodes</a>
88 <a href="debugging.html">Debugging</a>
89 <a href="layouts.html">Layouts</a>
90 <a href="trees.html">Trees</a>
91 <a href="subtrees.html">SubTrees</a>
92 <a href="groups.html">Groups</a>
93 <a href="subgraphs.html">SubGraphs</a>
94 <a href="sizedGroups.html">Sized Groups</a>
95 <a href="selection.html">Selection</a>
96 <a href="highlighting.html">Highlighting</a>
97 <a href="animation.html">Animation</a>
98 <a href="toolTips.html">ToolTips</a>
99 <a href="contextmenus.html">Context Menus</a>
100 <a href="events.html">Diagram Events</a>
101 <a href="tools.html">Tools</a>
102 <a href="commands.html">Commands</a>
103 <a href="permissions.html">Permissions</a>
104 <a href="validation.html">Validation</a>
105 <a href="HTMLInteraction.html">HTML Interaction</a>
106 <a href="layers.html">Layers &amp; Z-ordering</a>
107 <a href="palette.html">Palette</a>
108 <a href="overview.html">Overview</a>
109 <a href="resizing.html">Resizing Diagrams</a>
110 <a href="replacingDeleting.html">Replacing and Deleting</a>
111 <a href="buttons.html">Buttons</a>
112 <a href="templateMaps.html">Template Maps</a>
113 <a href="legends.html">Legends and Titles</a>
114 <a href="extensions.html">Extensions</a>
115 <a href="geometry.html">Geometry Strings</a>
116 <a href="grids.html">Grid Patterns</a>
117 <a href="graduatedPanels.html">Graduated Panels</a>
118 <a href="makingImages.html">Diagram Images</a>
119 <a href="makingSVG.html">Diagram SVG</a>
120 <a href="printing.html">Printing</a>
121 <a href="serverSideImages.html">Server-side Images</a>
122 <a href="nodeScript.html">GoJS in Node.js</a>
123 <a href="testing.html">Testing</a>
124 <a href="storage.html">Storage</a>
125 <a href="performance.html">Performance</a>
126 <a href="source.html">Building from Source</a>
127 <a href="platforms.html">Platforms</a>
128 <a href="deployment.html">Deployment</a>
129 </nav>
130 </div>
131 <div class="pt-4 px-2 md:px-0 lg:px-4 pb-16 w-full overflow-hidden">
132
133
134
135
136<h1>Ports in Nodes</h1>
137<p>
138Although you have some control over where links will connect at a node (at a particular spot, along one or
139more sides, or at the intersection with the edge), there are times when you want to have different logical
140and graphical places at which links should connect. The elements at which a link may connect are called
141<i>ports</i>. There may be any number of ports in a node. By default there is just one port, the whole node,
142which results in the effect of having the whole node act as the port, as you have seen in all of the previous examples.
143</p>
144<p>
145To declare that a particular element in a <a>Node</a> is a port, set the <a>GraphObject.portId</a> property to a string.
146Note that the port-or-link-related properties may apply to any element in the visual tree of the node,
147which is why they are properties of <a>GraphObject</a> rather than <a>Node</a>.
148</p>
149<p>
150Port-like GraphObjects can only be in <a>Node</a>s or <a>Group</a>s, not in <a>Link</a>s or <a>Adornment</a>s or simple <a>Part</a>s.
151So there is no reason to try to set <a>GraphObject.portId</a> on any object in a Link.
152</p>
153<p>
154<p>
155See samples that make use of ports in the <a href="../samples/index.html#ports">samples index</a>.
156</p>
157</p>
158
159<h2 id="SinglePorts">Single Ports</h2>
160<p>
161In many situations you want to consider links logically related to the node as a whole but you don't want links
162connecting to the whole node.
163In this case each node has only one port, but you do not want the whole node to act as the one port.
164</p>
165<p>
166For example, consider how links connect to the nodes when the whole node is acting as a port in one common manner.
167The <a>GraphObject.fromSpot</a> and <a>GraphObject.toSpot</a> are at the middles of the sides.
168Because the height of the whole node includes the text label,
169the middle of the side is not the middle of the "icon", which in this case is a circle.
170</p>
171<pre class="lang-js" id="defaultPort"><code>
172 diagram.nodeTemplate =
173 $(go.Node, "Vertical",
174 { fromSpot: go.Spot.Right, toSpot: go.Spot.Left }, // port properties on the node
175 $(go.Shape, "Ellipse",
176 { width: 30, height: 30, fill: "green" }),
177 $(go.TextBlock,
178 { font: "20px sans-serif" },
179 new go.Binding("text", "key"))
180 );
181
182 var nodeDataArray = [
183 { key: "Alpha" },
184 { key: "Beta" }
185 ];
186 var linkDataArray = [
187 { from: "Alpha", to: "Beta" }
188 ];
189 diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
190</code></pre>
191<script>goCode("defaultPort", 600, 100)</script>
192<p>
193This appearance does not look or behave quite right.
194Really we want links to connect to the circular <a>Shape</a>.
195</p>
196
197<p>
198If you want a particular element to act as the port rather than the whole node,
199just set its <a>GraphObject.portId</a> to the empty string.
200The empty string is the name of the default port.
201</p>
202<p>
203In this example, we set <a>GraphObject.portId</a> on the circular shape.
204Note that we move the other port-related properties, such as the port spots, to that object too.
205</p>
206<pre class="lang-js" id="singlePort"><code>
207 diagram.nodeTemplate =
208 $(go.Node, "Vertical",
209 $(go.Shape, "Ellipse",
210 { width: 30, height: 30, fill: "green",
211 portId: "", // now the Shape is the port, not the whole Node
212 fromSpot: go.Spot.Right, // port properties go on the port!
213 toSpot: go.Spot.Left
214 }),
215 $(go.TextBlock,
216 { font: "20px sans-serif" },
217 new go.Binding("text", "key"))
218 );
219
220 var nodeDataArray = [
221 { key: "Alpha" },
222 { key: "Beta" }
223 ];
224 var linkDataArray = [
225 { from: "Alpha", to: "Beta" }
226 ];
227 diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
228</code></pre>
229<script>goCode("singlePort", 600, 100)</script>
230<p>
231Notice how the links nicely connect the circular shapes by ignoring the text labels.
232</p>
233
234<h2 id="GeneralPorts">General Ports</h2>
235<p>
236It is also common to have diagrams where you want more than one port in a node.
237The number of ports might even vary dynamically.
238</p>
239<p>
240In order for a link data object to distinguish which port the link should connect to,
241the <a>GraphLinksModel</a> supports two additional data properties that identify the names of the ports in the nodes
242at both ends of the link.
243<a>GraphLinksModel.getToKeyForLinkData</a> identifies the node to connect to;
244<a>GraphLinksModel.getToPortIdForLinkData</a> identifies the port within the node.
245Similarly, <a>GraphLinksModel.getFromKeyForLinkData</a> and <a>GraphLinksModel.getFromPortIdForLinkData</a> identify the node and its port.
246</p>
247<p>
248Normally a <a>GraphLinksModel</a> assumes that there is no need to recognize port information on link data.
249If you want to support port identifiers on link data, you need to set <a>GraphLinksModel.linkToPortIdProperty</a>
250and <a>GraphLinksModel.linkFromPortIdProperty</a> to be the names of the link data properties.
251If you do not set these properties, all port identifiers are assumed to be the empty string,
252which is the name of the one default port for a node.
253</p>
254<p class="box bg-danger">
255If you have set or bound <a>GraphObject.portId</a> on any element to be a non-empty string,
256you will need to use a <a>GraphLinksModel</a> and set <a>GraphLinksModel.linkToPortIdProperty</a>
257and <a>GraphLinksModel.linkFromPortIdProperty</a> to be the names of two properties on your link data,
258or you will need to hard code the portId names in the link template(s)
259(i.e. <a>Link.fromPortId</a> and <a>Link.toPortId</a>),
260in order for the user to be able to link with those ports.
261</p>
262<pre class="lang-js" id="ports"><code>
263 diagram.nodeTemplate =
264 $(go.Node, "Auto",
265 $(go.Shape, "Rectangle", { fill: "lightgray" }),
266 $(go.Panel, "Table",
267 $(go.RowColumnDefinition,
268 { column: 0, alignment: go.Spot.Left}),
269 $(go.RowColumnDefinition,
270 { column: 2, alignment: go.Spot.Right }),
271 $(go.TextBlock, // the node title
272 { column: 0, row: 0, columnSpan: 3, alignment: go.Spot.Center,
273 font: "bold 10pt sans-serif", margin: new go.Margin(4, 2) },
274 new go.Binding("text", "key")),
275 $(go.Panel, "Horizontal",
276 { column: 0, row: 1 },
277 $(go.Shape, // the "A" port
278 { width: 6, height: 6, portId: "A", toSpot: go.Spot.Left }),
279 $(go.TextBlock, "A") // "A" port label
280 ),
281 $(go.Panel, "Horizontal",
282 { column: 0, row: 2 },
283 $(go.Shape, // the "B" port
284 { width: 6, height: 6, portId: "B", toSpot: go.Spot.Left }),
285 $(go.TextBlock, "B") // "B" port label
286 ),
287 $(go.Panel, "Horizontal",
288 { column: 2, row: 1, rowSpan: 2 },
289 $(go.TextBlock, "Out"), // "Out" port label
290 $(go.Shape, // the "Out" port
291 { width: 6, height: 6, portId: "Out", fromSpot: go.Spot.Right })
292 )
293 )
294 );
295
296 diagram.linkTemplate =
297 $(go.Link,
298 { routing: go.Link.Orthogonal, corner: 3 },
299 $(go.Shape),
300 $(go.Shape, { toArrow: "Standard" })
301 );
302
303 diagram.layout = $(go.LayeredDigraphLayout, { columnSpacing: 10 });
304
305 diagram.model =
306 $(go.GraphLinksModel,
307 { linkFromPortIdProperty: "fromPort", // required information:
308 linkToPortIdProperty: "toPort", // identifies data property names
309 nodeDataArray: [
310 { key: "Add1" },
311 { key: "Add2" },
312 { key: "Subtract1" }
313 ],
314 linkDataArray: [
315 { from: "Add1", fromPort: "Out", to: "Subtract1", toPort: "A" },
316 { from: "Add2", fromPort: "Out", to: "Subtract1", toPort: "B" }
317 ] });
318</code></pre>
319<script>goCode("ports", 600, 150)</script>
320
321<h2 id="DrawingNewLinks">Drawing new Links</h2>
322<p>
323Setting either or both of the <a>GraphObject.fromLinkable</a> and <a>GraphObject.toLinkable</a>
324properties to true allows users to interactively draw new links between ports.
325</p>
326<p>
327To draw a new link, mouse down on an "Out" port, move (drag) to nearby an input port,
328and then mouse-up to complete the link.
329</p>
330<pre class="lang-js" id="linkablePorts"><code>
331 diagram.nodeTemplate =
332 $(go.Node, "Auto",
333 $(go.Shape, "Rectangle", { fill: "lightgray" }),
334 $(go.Panel, "Table",
335 $(go.RowColumnDefinition,
336 { column: 0, alignment: go.Spot.Left}),
337 $(go.RowColumnDefinition,
338 { column: 2, alignment: go.Spot.Right }),
339 $(go.TextBlock, // the node title
340 { column: 0, row: 0, columnSpan: 3, alignment: go.Spot.Center,
341 font: "bold 10pt sans-serif", margin: new go.Margin(4, 2) },
342 new go.Binding("text", "key")),
343 $(go.Panel, "Horizontal",
344 { column: 0, row: 1 },
345 $(go.Shape, // the "A" port
346 { width: 6, height: 6, portId: "A", toSpot: go.Spot.Left,
347 toLinkable: true, toMaxLinks: 1 }), // allow user-drawn links from here
348 $(go.TextBlock, "A") // "A" port label
349 ),
350 $(go.Panel, "Horizontal",
351 { column: 0, row: 2 },
352 $(go.Shape, // the "B" port
353 { width: 6, height: 6, portId: "B", toSpot: go.Spot.Left,
354 toLinkable: true, toMaxLinks: 1 }), // allow user-drawn links from here
355 $(go.TextBlock, "B") // "B" port label
356 ),
357 $(go.Panel, "Horizontal",
358 { column: 2, row: 1, rowSpan: 2 },
359 $(go.TextBlock, "Out"), // "Out" port label
360 $(go.Shape, // the "Out" port
361 { width: 6, height: 6, portId: "Out", fromSpot: go.Spot.Right,
362 fromLinkable: true }) // allow user-drawn links to here
363 )
364 )
365 );
366
367 diagram.linkTemplate =
368 $(go.Link,
369 { routing: go.Link.Orthogonal, corner: 3 },
370 $(go.Shape),
371 $(go.Shape, { toArrow: "Standard" })
372 );
373
374 diagram.layout = $(go.LayeredDigraphLayout, { columnSpacing: 10 });
375
376 diagram.toolManager.linkingTool.temporaryLink.routing = go.Link.Orthogonal;
377
378 diagram.model =
379 $(go.GraphLinksModel,
380 { linkFromPortIdProperty: "fromPort", // required information:
381 linkToPortIdProperty: "toPort", // identifies data property names
382 nodeDataArray: [
383 { key: "Add1" },
384 { key: "Add2" },
385 { key: "Subtract1" }
386 ],
387 linkDataArray: [
388 // no predeclared links
389 ] });
390</code></pre>
391<script>goCode("linkablePorts", 600, 250)</script>
392<p>
393By default the user may not draw more than one link in the same direction between any pair of ports,
394nor may the user draw a link connecting a node with itself.
395Please read a general discussion of <a href="validation.html">Linking Validation</a>.
396</p>
397<p>
398By setting <a>GraphObject.toMaxLinks</a> to 1, as shown in this example, the user may draw at most one link going into that port.
399And because <a>GraphObject.fromLinkable</a> is false for that port element, the user will not be able to connect any links coming out of that port.
400</p>
401<p>
402 If you want to prevent the user from connecting any more than one Link with a Node, regardless of direction,
403 you will need to implement a <a>LinkingBaseTool.linkValidation</a> or a <a>Node.linkValidation</a> predicate.
404 See the discussion about <a href="validation.html#GeneralLinkingValidation">General Linking Validation</a>
405</p>
406
407 </div>
408 </div>
409
410 <div class="bg-nwoods-primary">
411 <section class="max-w-screen-lg text-white container mx-auto py-2 px-12">
412 <p id="version" class="leading-none mb-2 my-4">GoJS</p>
413 </section>
414 </div><footer class="bg-nwoods-primary text-white">
415 <div class="container max-w-screen-lg mx-auto px-8">
416 <div class="w-full py-6">
417
418 <div class="max-w-screen-lg xl:max-w-screen-xl mx-auto px-4 sm:px-6 md:px-8">
419 <ul class="text-sm font-medium pb-14 sm:pb-20 grid grid-cols-1 sm:grid-cols-3 gap-y-10">
420 <li class="list-none row-span-2">
421 <h2 class="text-base font-semibold tracking-wide">GoJS</h2>
422 <ul class="list-none space-y-4 md:space-y-1 px-0">
423 <li>
424 <a href="../samples/index.html">Samples</a>
425 </li>
426 <li>
427 <a href="../learn/index.html">Learn</a>
428 </li>
429 <li>
430 <a href="../intro/index.html">Intro</a>
431 </li>
432 <li>
433 <a href="../api/index.html">API</a>
434 </li>
435 <li>
436 <a href="../changelog.html">Changelog</a>
437 </li>
438 <li>
439 <a href="https://github.com/NorthwoodsSoftware/GoJS">GitHub</a>
440 </li>
441 </ul>
442 </li>
443 <li class="list-none row-span-2">
444 <h2 class="text-base font-semibold tracking-wide">Support</h2>
445 <ul class="list-none space-y-4 md:space-y-1 px-0">
446 <li>
447 <a href="https://www.nwoods.com/contact.html"
448 target="_blank" rel="noopener" onclick="getOutboundLink('https://www.nwoods.com/contact.html', 'contact');">Contact</a>
449 </li>
450 <li>
451 <a href="https://forum.nwoods.com/c/gojs">Forum</a>
452 </li>
453 <li>
454 <a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a>
455 </li>
456 <li>
457 <a href="https://www.nwoods.com/sales/index.html"
458 target="_blank" rel="noopener" onclick="getOutboundLink('https://www.nwoods.com/sales/index.html', 'buy');">Buy</a>
459 </li>
460 <li>
461 <a href="https://www.youtube.com/channel/UC9We8EoX596-6XFjJDtZIDg">Videos</a>
462 </li>
463 </ul>
464 </li>
465 <li class="list-none row-span-2">
466 <h2 class="text-base font-semibold tracking-wide">Company</h2>
467 <ul class="list-none space-y-4 md:space-y-1 px-0">
468 <li>
469 <a href="https://www.nwoods.com">Northwoods</a>
470 </li>
471 <li>
472 <a href="https://www.nwoods.com/about.html">About Us</a>
473 </li>
474 <li>
475 <a href="https://www.nwoods.com/contact.html">Contact Us</a>
476 </li>
477 <li>
478 <a href="https://twitter.com/northwoodsgo">Twitter</a>
479 </li>
480
481 </ul>
482 </li>
483 </ul>
484
485
486 <p class="text-sm text-gray-100 md:mb-6">
487 Copyright 1998-2021 <a class="text-white" href="https://www.nwoods.com">Northwoods Software</a>
488 </p>
489 </div>
490 </div>
491</footer> </body>
492
493<script async src="https://www.googletagmanager.com/gtag/js?id=UA-1506307-5"></script>
494<script>
495 window.dataLayer = window.dataLayer || [];
496 function gtag(){dataLayer.push(arguments);}
497 gtag('js', new Date()); gtag('config', 'UA-1506307-5');
498 var getOutboundLink = function(url, label) {
499 gtag('event', 'click', {
500 'event_category': 'outbound',
501 'event_label': label,
502 'transport_type': 'beacon'
503 });
504 }
505
506 // topnav
507 var topButton = document.getElementById("topnavButton");
508 var topnavList = document.getElementById("topnavList");
509 topButton.addEventListener("click", function() {
510 this.classList.toggle("active");
511 topnavList.classList.toggle("hidden");
512 document.getElementById("topnavOpen").classList.toggle("hidden");
513 document.getElementById("topnavClosed").classList.toggle("hidden");
514 });
515</script>
516 <script src="../assets/js/prism.js"></script>
517 <script src="../release/go.js"></script>
518 <script src="../assets/js/goDoc.js"></script>
519 <script>
520 document.addEventListener("DOMContentLoaded", function() {
521 if (window.go) document.getElementById('version').textContent = "GoJS version " + go.version;
522 if (window.goDoc) window.goDoc();
523 var d = window.diagrams;
524 for (var i = 0; i < d.length; i++) {
525 var dargs = d[i];
526 goCodeExecute(dargs[0], dargs[1], dargs[2], dargs[3], dargs[4]);
527 }
528 if (window.extra) window.extra();
529 });
530 </script>
531</html>