Install GoJS extensions via npm
masterGoJS extensions are published as a separate package named gojs-extensions.
$ npm install gojs-extensionsrepository·master·Indexed 27 days ago
https://github.com/northwoodssoftware/gojsA professional JavaScript and TypeScript library for creating interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, and BPMN. Version 4.0.3 supports rendering to HTML Canvas or SVG DOM and runs in web browsers, Node.js, or Puppeteer.
GoJS extensions are published as a separate package named gojs-extensions.
$ npm install gojs-extensionsYou can install the core GoJS library using npm. Note that the npm package contains only the library; samples and documentation are available separately via the GitHub repository or the official website.
$ npm install gojsGoJS is a JavaScript and TypeScript library for creating and manipulating interactive diagrams, charts, and graphs.
Key Features:
The main repository contains only the library. To install the full GoJS kit, which includes all samples, extensions, and documentation, run the following command:
$ npm create gojs-kitTo create a diagram, you need an HTML element to host it, a go.Diagram instance, templates to define how nodes and links look, and a model to provide the data. The following example demonstrates a basic graph with nodes and links using the fluent add() API and data binding.
<div id="myDiagramDiv" style="width:400px; height:200px;"></div>
<script src="https://cdn.jsdelivr.net/npm/gojs"></script>
<script>
const myDiagram = new go.Diagram('myDiagramDiv', {
// create a Diagram for the HTML div element
'undoManager.isEnabled': true // enable undo & redo
});
// define a simple Node template
// the Shape will automatically surround the TextBlock
myDiagram.nodeTemplate = new go.Node('Auto')
.add( // add a Shape and a TextBlock to this "Auto" Panel
new go.Shape('RoundedRectangle', { strokeWidth: 0, fill: 'white' }) // no border; default fill is white
.bind('fill', 'color'), // Shape.fill is bound to Node.data.color
new go.TextBlock({ margin: 8, font: 'bold 14px sans-serif', stroke: '#333' }) // some room around the text
.bind('text', 'key') // TextBlock.text is bound to Node.data.key
);
// but use the default Link template, by not setting Diagram.linkTemplate
// create the model data that will be represented by Nodes and Links
myDiagram.model = new go.GraphLinksModel(
[
{ key: 'Alpha', color: 'lightblue' },
{ key: 'Beta', color: 'orange' },
{ key: 'Gamma', color: 'lightgreen' },
{ key: 'Delta', color: 'pink' }
],
[
{ from: 'Alpha', to: 'Beta' },
{ from: 'Alpha', to: 'Gamma' },
{ from: 'Beta', to: 'Beta' },
{ from: 'Gamma', to: 'Delta' },
{ from: 'Delta', to: 'Alpha' }
]
);
</script>