我们的在线示例展示了如何构建不同的图表类型、相关的功能特性和同步的布局方式,您可以使用这些示例中的 HTML 和 JavaScript 代码作为您的应用程序的起点。
如果您已经看过本页面相关例子并准备自己尝试使用 GoJS,请阅读我们的 快速入门 教程
如果要查找特定 GoJS 方法或属性的示例,可以利用 Github 的搜索功能来查找所有示例、扩展和文档的源代码:

A standard flowchart, showing different node templates and several data bindings. Each node has 3 or 4 port elements. Links are orthogonal and avoid nodes.

Shows an organizational chart, uses an in-laid Overview to aid the user in navigation, and allows the user to search by example.

Shows default Diagram interactivity and basic data binding. Select, move, copy, delete, undo, redo with keyboard or touch.

Showcases all pre-defined GoJS figures. You can define your own named Shape figures.
Create your own custom Shapes using SVG path strings. This sample uses SVG strings from a free icon set.

Sankey diagrams show the amount of flow between nodes by the width of the links.

A simple PERT chart, showcasing GoJS table panels and RowColumnDefinition properties.

Demonstrates a simple Gantt chart.

A read-only diagram where clicking on a node will open a new webpage.

Drag-and-drop items from the Palette onto racks in the Diagram.

Displays the GoJS Class Hierarchy as a series of trees. Double-click to go to the class's API documentation.

This sample shows the actual visual tree of a running Diagram, using a second Diagram.

Shows a standard family tree.

Shows a standard family tree.

Two diagrams, the one on top showing a full tree and the one below focusing on a specific node in the tree and those nodes that are logically "near" it.

Displays a single diagram of two trees sharing a single root node growing in opposite directions, using two layouts.

Double Tree, loading JSON from server.

Tournament bracket with dynamic advancement as scores are entered.

A tree layout with rectangular nodes at alternating angles and no links.

A genogram or pedigree chart is an extended family tree diagram that show information about each person or each relationship.

Demonstrates reading JSON data describing the relative rankings of NFL teams at a particular moment in time and generating a diagram from that data.

A web of interlinked concepts displayed with a ForceDirected Layout, showcasing link labels.

Animation of diagram parts (tokens) along link paths.

Show distances between two nodes and highlights one of all possible paths between the nodes.

Showcases all pre-defined Link arrowheads. You can define your own named arrowhead geometries.

Shows how you can create custom renderings for Links by repeatedly drawing GraphObjects along the route.

An example customization of the Link.curviness property and having an arrowhead at the middle of the link route.

Demonstrates custom routing for Links running through other Nodes.

Demonstrates a custom Geometry for Link paths.

A custom orthogonal Link that draws arrowheads at the end of each segment.

Showcases draggable disconnectable links that can be connected by dropping one or both ends at a valid port.

Demonstrates the ability for a Link to appear to connect with another Link, using label nodes that belong to links.

Displays relationships between different parts of a diagram.

BPMN Choreography that demonstrates subgraphs that have rounded headers and rounded footers.

Layer Bands are automatically created for each "layer" of a TreeLayout, and run perpendicular to the layout.

This shows the same visual tree using nested Groups instead of nodes and links.

As an alternative to using Groups, this manages Nodes that simultaneously belong to multiple containers.

Shows GridLayout and options. Places all of the Parts in a grid-like arrangement, ordered, spaced apart, and wrapping as needed.

Shows TreeLayout and options. Positions nodes of a tree-structured graph in layers (rows or columns).

Shows ForceDirectedLayout and options. Treats the graph as if it were a system of physical bodies with forces acting on them and between them.

Shows LayeredDigraphLayout and options. Arranges nodes of directed graphs into layers (rows or columns).

Shows CircularLayout and options. This layout positions nodes in a circular arrangement.

A continuous ForceDirectedLayout that occurs as the user drags around a node.

Multiple circles using repeated CircularLayouts.

Demonstrates a customized CircularLayout.

Arrange people in circles around a central person, in layers according to distance from the central person.

Arrange people in rings around a central person, in layers according to distance from the central person.

Tanks, valves, and pipes, with animated flow in the pipes.

Partially describes the production process for converting natural gas and oil byproducts into their end products.

A System Dynamics diagram shows the storages and flows of material in some system, and the factors that influence the rates of flow.

A sequence diagram that shows different node templates, LayeredDigraphLayout and in-place text editing.

A sequence diagram illustrates how different processes interact with one-another and in what order.

A functioning logic circuit diagram, which allows the user to make circuits using gates and wires.

Show the processing steps involved in a database transformation or query, with labeled ports.

Same as Data Flow, but vertically oriented, and with slightly different styling.

A Node with ports that can be selected and deleted.

A Group with Nodes acting as ports that can be dragged within and between nodes.

Simple bar charts or histograms within nodes.

Simple pie charts within nodes.

Simple candlestick or range charts within nodes.

Simple sparkline charts within nodes.

Graduated thermometer scales using Graduated Panel.

A gauge using a scale made with a Graduated Panel.

Showcases alignment properties of the Diagram.

Contains two draggable HTML elements (using jQuery UI). One of the two HTML elements houses a panel that interacts with the main Diagram.

Demonstrates using a custom HTML element for in-place editing of a TextBlock.

Shows how to render a data-driven chart within each Node using the Chart.js library.

A data-visualization demonstration that showcases GoJS interacting with other elements on the page.

A GoJS diagram atop a Leaflet.js map, with nodes placed at latitude and longitude based locations.

This sample demonstrates custom logic in a GoJS diagram - a "Person" node can be dropped onto a "Table" node, causing the person to be assigned a position at the closest empty seat at that table.

A simple timeline with events arranged along a line.

A diagram with Graduated Panels at the edges acting as rulers.

Shows the continuously updating state of a number of stations on an imaginary shop floor.

A monitoring diagram where the nodes (kittens) move about a house, with tooltips for each kitten.

Displays a variable number of fields for each record, with links mapping one field to another.

Records with fields that the user can select.

Demonstrates adding and removing columns of a Table Panel.

A diagram that does not scroll or zoom or allow parts to be dragged out of a fixed area.

An Overview used as a magnifying glass.

GoJS supports the notion of "Comments", including the ability to create balloon-like comments.

A word cloud visualization using the PackedLayout extension.

Shows a tiger rendered in SVG.

The Fishbone or Ishikawa layout is a tree layout for cause-and-effect relationships.

A custom Layout that positions a chain of nodes in rows of alternating direction.

A custom Layout that positions a chain of nodes in a spiral.

A custom Layout that renders nested Groups into the viewport with each Node having an area proportional to its declared 'size'.

A custom Layout that arranges Nodes just as a Table Panel arranges GraphObjects.

A custom Layout that positions nodes in a packed area.

A custom Tool that lets a user drag and create a box to select nodes and links.

A custom Tool that lets a user draw a box showing where and how large a new node should be.

A custom Tool that lets a user draw a box showing what to zoom in to.

A custom ResizingTool that lets the user resize many selected objects at once.

A custom RotatingTool that lets the user rotate many selected objects at once.

A custom Tool that lets the user reshape orthogonal links by dragging entire segments.

A custom Tool which allows the user to resize the overview box.

A custom Tool that allows reshaping links with grid snapping.

A custom Tool that supports interactive reshaping of Geometries.

A custom Tool that supports interactive reshaping of pie-shaped sectors of circles.

A custom Tool that lets the user interactively draw a line, converting it into a Shape.

A custom Tool that lets the user interactively draw polygons and polyline Shapes.

A custom LinkingTool that lets the user determine the route of a new Link by clicking.

A custom Tool that adds handles on Links to allow the user to shift the end point of the Link along the sides of the port without disconnecting it.

A custom Tool that lets the user drag a label on a Link and that keeps its relative position to the link.

A custom Tool that lets the user drag a label on a Link and that keeps the label along the path of the link.

A custom Tool that lets the user drag a label in a Spot Panel of a Node.

A custom DraggingTool that lets the user drag a translucent image of the Nodes and Links to be moved, leaving them in place until the mouse up.

A custom DraggingTool that makes guidelines visible as a Part is dragged around a Diagram and is nearly aligned with another Part.

A custom Tool that lets the user drag a port in a Spot Panel of a Node.

Two custom Tools that let the user resize the width of columns or the height of rows in a Table Panel of a Node.

A simple drop-in for inspecting and editing Part data.

A more complex inspector for inspecting all sorts of GraphObject, Node, Link, Shape, etc properties, and Part data.

Demonstrates usage of the HyperlinkText extension.

Demonstrates using an HTMLInfo that acts as a re-implementation of the default text editor.

Demonstrates a Node with a top half and a bottom half, with rounded corners.

Demonstrates custom Links that create a "Balloon" around the fromNode.

Demonstrates custom Links that route parallel to other Links between the same two ports.

Demonstrates custom Links that show the distance between two points.

Demonstrates custom CommandHandler which provides alignment commands and additional behaviors for the arrow keys.

Demonstrates custom CommandHandler which uses localStorage as the repository for the clipboard, rather than an in-memory global variable, allowing for copying between tabs and windows.

Demonstrates dynamically choosing the user's cloud storage service (using the user's credentials) or localStorage.

Demonstrates use of the ZoomSlider class to zoom in/out using a control.

A tool to open plans made in Floor Pan Editor and watch simulated alerts.

Minimal, loading JSON from server.

Minimal, loading XML from server.

Minimal, showing image Blob creation with Diagram.makeImageData, and download.

Minimal, showing SVG creation with Diagram.makeSvg, and download.

Minimal, using RequireJS.

Minimal, using AngularJS.

Minimal, using Vue.js.

When zooming, change the spacing of the Nodes, not the Diagram.scale.

Shows different options for ToolManager's gestureBehavior.

Demonstrates customization of pinch-zooming to scale a node.

Shows infinite scrolling and positionComputation.

Kitten Monitor with constant size markers and tooltips when zooming out.

An example of virtualization where the model holds 123,456 node data yet the diagram only creates a few nodes at a time.

Shows a virtualized TreeLayout with TreeModel.

Shows a virtualized ForceDirectedLayout with GraphLinksModel.

Demonstrates a flow-chart-like editor of a restricted syntax language.

Shows a network configurator with a Palette and Overview.

Drag out fields from record Nodes to an HTML element.

Drag and drop fields from/to record Nodes.

Demonstrates drag and drop between two different diagrams using a shared UndoManager.

Demonstrates dragging and dropping from HTML.

Demonstrates dragging and dropping from HTML using jQuery.

Demonstrates an automatic ungrouping of nodes when dropping an element on the diagram.

Demonstrates a function to avoid any overlapping of nodes during dragging.

Shows how to create a Diagram within a jQuery UI Tab.

Shows how to create a custom PaneLayout.