GoJS

JavaScript diagramming library for interactive flowcharts, org charts, desi...

README

GoJS


GoJS a JavaScript Library for HTML Diagrams


GoJS is a flexible library that can be used to create a number of different kinds of interactive diagrams, including data visualizations, drawing tools, and graph editors. There are samples for flowchart. GoJS includes a number of built in layouts including tree layout, force directed, radial, and layered digraph layout, and a number of custom layout examples.

GoJS is rendered with an HTML Canvas element (with export to SVG or image formats). GoJS can run in a web browser, or server side in Node or Puppeteer. GoJS Diagrams are backed by Models, with saving and loading typically via JSON.


Read more about GoJS at gojs.net

This repository contains both the library and the sources for all samples, extensions, and documentation.
You can use the GitHub repository to quickly search through all of the sources.

Minimal Sample


Graphs are constructed by creating one or more templates, with desired properties data-bound, and adding model data.

  1. ```html
  2. <div id="myDiagramDiv" style="width:400px; height:150px;"></div>
  3. <script src="https://unpkg.com/gojs"></script>
  4. <script>
  5. const myDiagram =
  6.   new go.Diagram("myDiagramDiv",  // create a Diagram for the HTML Div element
  7.     { "undoManager.isEnabled": true });  // enable undo & redo
  8. // define a simple Node template
  9. myDiagram.nodeTemplate =
  10.   new go.Node("Auto")  // the Shape will automatically surround the TextBlock
  11.     // add a Shape and a TextBlock to this "Auto" Panel
  12.     .add(new go.Shape("RoundedRectangle",
  13.         { strokeWidth: 0, fill: "white" })  // no border; default fill is white
  14.         .bind("fill", "color"))  // Shape.fill is bound to Node.data.color
  15.     .add(new go.TextBlock({ margin: 8, stroke: "#333" })  // some room around the text
  16.         .bind("text", "key"));  // TextBlock.text is bound to Node.data.key
  17. // but use the default Link template, by not setting Diagram.linkTemplate
  18. // create the model data that will be represented by Nodes and Links
  19. myDiagram.model = new go.GraphLinksModel(
  20.   [
  21.     { key: "Alpha", color: "lightblue" },
  22.     { key: "Beta", color: "orange" },
  23.     { key: "Gamma", color: "lightgreen" },
  24.     { key: "Delta", color: "pink" }
  25.   ],
  26.   [
  27.     { from: "Alpha", to: "Beta" },
  28.     { from: "Alpha", to: "Gamma" },
  29.     { from: "Beta", to: "Beta" },
  30.     { from: "Gamma", to: "Delta" },
  31.     { from: "Delta", to: "Alpha" }
  32.   ]);
  33. </script>
  34. ```

The above diagram and model code creates the following graph.
The user can now click on nodes or links to select them, copy-and-paste them, drag them, delete them, scroll, pan, and zoom, with a mouse or with fingers.


Click the image to see the interactive GoJS Diagram


Support


Northwoods Software offers a month of free developer-to-developer support for GoJS to help you get started on your project.

Read and search the official GoJS forum for any topics related to your questions.

Posting in the forum is the fastest and most effective way of obtaining support for any GoJS related inquiries.
Please register for support at Northwoods Software's registration form before posting in the forum.

For any nontechnical questions about GoJS, such as about sales or licensing,
please visit Northwoods Software's contact form.

License


The GoJS software license.

Copyright (c) Northwoods Software Corporation