A Diagram is associated with an HTML DIV element. Constructing a Diagram creates an HTML Canvas element which it places inside of the given DIV element, in addition to several helper divs. GoJS will manage the contents of this DIV, and the contents should not be modified otherwise, though the given DIV may be styled (background, border, etc) and positioned as needed.
Construct an empty Diagram for a particular DIV HTML element.
A reference to a DIV HTML element in the DOM. If no DIV is supplied one will be created in memory. The Diagram's Diagram#div property can then be set later on.
Construct an empty Diagram for a particular DIV HTML element.
The ID of a DIV element in the DOM. If no DIV identifier is supplied one will be created in memory. The Diagram's Diagram#div property can then be set later on.
This value for Diagram#validCycle states that there are no restrictions on making cycles of links.
This value for Diagram#validCycle states that any number of destination links may go out of a node, but at most one source link may come into a node, and there are no directed cycles.
This value for Diagram#validCycle states that a valid link from a node will not produce a directed cycle in the graph.
This value for Diagram#validCycle states that a valid link from a node will not produce an undirected cycle in the graph.
This value for Diagram#validCycle states that any number of source links may come into a node, but at most one destination link may go out of a node, and there are no directed cycles.
The default autoScale type, used as the value of Diagram#autoScale: The Diagram does not attempt to scale its bounds to fit the view.
Diagrams with this autoScale type, used as the value of Diagram#autoScale, are scaled uniformly until the documentBounds fits in the view.
Diagrams with this autoScale type, used as the value of Diagram#autoScale, are scaled uniformly until the documentBounds fits in the view.
Gets or sets whether the user may copy to or paste parts from the internal clipboard.
Gets or sets whether the user may copy objects.
Gets or sets whether the user may delete objects from the Diagram.
Gets or sets whether the user may start a drag-and-drop in this Diagram, possibly dropping in a different element.
Gets or sets whether the user may end a drag-and-drop operation in this Diagram.
Gets or sets whether the user may group parts together.
Gets or sets whether the user is allowed to use the horizontal scrollbar.
Gets or sets whether the user may add parts to the Diagram.
Gets or sets whether the user may draw new links.
Gets or sets whether the user may move objects.
Gets or sets whether the user may reconnect existing links.
Gets or sets whether the user may reshape parts.
Gets or sets whether the user may resize parts.
Gets or sets whether the user may rotate parts.
Gets or sets whether the user may select objects.
Gets or sets whether the user may do in-place text editing.
Gets or sets whether the user may undo or redo any changes.
Gets or sets whether the user may ungroup existing groups.
Gets or sets whether the user is allowed to use the vertical scrollbar.
Gets or sets whether the user may zoom into or out of the Diagram.
Gets or sets the autoScale of the Diagram, controlling whether or not the Diagram's bounds automatically scale to fit the view.
Gets or sets the Margin (or number for a uniform Margin) that describes the Diagram's autoScrollRegion.
Gets or sets the function to execute when the user single-primary-clicks on the background of the Diagram.
Gets or sets the CommandHandler for this Diagram.
Gets or sets the content alignment Spot of this Diagram, to be used in determining how parts are positioned when the #viewportBounds width or height is smaller than the #documentBounds.
Gets or sets the function to execute when the user single-secondary-clicks on the background of the Diagram.
This Adornment is shown when the use context clicks in the background.
Gets or sets the current cursor for the Diagram, overriding the #defaultCursor.
Gets or sets the current tool for this Diagram that handles all input events.
Gets or sets the cursor to be used for the Diagram when no GraphObject specifies a different cursor.
Gets or sets the default tool for this Diagram that becomes the current tool when the current tool stops.
Gets or sets the Diagram's HTMLDivElement, via an HTML Element ID.
Gets the model-coordinate bounds of the Diagram.
Gets or sets the function to execute when the user double-primary-clicks on the background of the Diagram.
Gets or sets the most recent mouse-down InputEvent that occurred.
Gets or sets a fixed bounding rectangle to be returned by #documentBounds and #computeBounds.
Gets or sets a Panel of type Panel#Grid acting as the background grid extending across the whole viewport of this diagram.
Gets or sets the default selection Adornment template, used to adorn selected Groups.
Gets or sets the default Group template used as the archetype for group data that is added to the #model.
Gets or sets a Map mapping template names to Groups.
Gets or sets whether the Diagram has a horizontal Scrollbar.
Gets or sets whether the Diagram has a vertical Scrollbar.
Gets or sets the initialAutoScale of the Diagram.
Gets or sets the initial content alignment Spot of this Diagram, to be used in determining how parts are positioned initially relative to the viewport.
Gets or sets the spot in the document's area that should be coincident with the #initialViewportSpot of the viewport when the document is first initialized.
Gets or sets the initial coordinates of this Diagram in the viewport, eventually setting the #position.
Gets or sets the initial scale of this Diagram in the viewport, eventually setting the #scale.
Gets or sets the spot in the viewport that should be coincident with the #initialDocumentSpot of the document when the document is first initialized.
Gets or sets whether the user may interact with the Diagram.
Gets or sets whether the Diagram's Diagram#model is Model#isReadOnly.
Gets or sets whether this Diagram's state has been modified.
Gets or sets whether mouse events initiated within the Diagram will be captured.
Gets or sets whether the Diagram may be modified by the user, while still allowing the user to scroll, zoom, and select.
Gets or sets whether the Diagram tree structure is defined by links going from the parent node to their children, or vice-versa.
Gets or sets the last InputEvent that occurred.
Gets an iterator for this Diagram's Layers.
Gets or sets the Layout used to position all of the top-level nodes and links in this Diagram.
Gets or sets the default selection Adornment template, used to adorn selected Links.
Gets or sets the default Link template used as the archetype for link data that is added to the #model.
Gets or sets a Map mapping template names to Links.
Returns an iterator of all Links in the Diagram.
Gets or sets the largest value that #scale may take.
Gets or sets the maximum number of selected objects.
Gets or sets the smallest value greater than zero that #scale may take.
Gets or sets the Model holding data corresponding to the data-bound nodes and links of this Diagram.
Gets or sets the function to execute when the user is dragging the selection in the background of the Diagram during a DraggingTool drag-and-drop, not over any GraphObjects.
Gets or sets the function to execute when the user drops the selection in the background of the Diagram at the end of a DraggingTool drag-and-drop, not onto any GraphObjects.
Gets or sets the function to execute when the user holds the mouse stationary in the background of the Diagram while holding down a button, not over any GraphObjects.
Gets or sets the function to execute when the user holds the mouse stationary in the background of the Diagram without holding down any buttons, not over any GraphObjects.
Gets or sets the function to execute when the user moves the mouse in the background of the Diagram without holding down any buttons, not over any GraphObjects.
Gets or sets the default selection Adornment template, used to adorn selected Parts other than Groups or Links.
Gets or sets the default Node template used as the archetype for node data that is added to the #model.
Gets or sets a Map mapping template names to Parts.
Returns an iterator of all Nodes and Groups in the Diagram.
Gets or sets the Margin (or number for a uniform Margin) that describes the Diagram's padding, which controls how much extra space there is around the area occupied by the document.
Returns an iterator of all Parts in the Diagram that are not Nodes or Links or Adornments.
Gets or sets the coordinates of this Diagram in the viewport.
Gets or sets the scale transform of this Diagram.
Gets or sets the distance in screen pixels that the horizontal scrollbar will scroll when scrolling by a line.
Gets or sets the distance in screen pixels that the vertical scrollbar will scroll when scrolling by a line.
Gets the read-only collection of selected objects.
Gets or sets whether ChangedEvents are not recorded by the UndoManager.
Gets the UndoManager for this Diagram, which actually belongs to the #model.
This Adornment is shown when the mouse stays motionless in the background.
Gets the UndoManager for this Diagram, which actually belongs to the #model.
Gets or sets what kinds of graphs this diagram allows the user to draw.
Gets the bounds of the portion of the Diagram that is viewable from its HTML Canvas.
Gets or sets the point, in viewport coordinates, where changes to the #scale will keep the focus in the document.
Adds a Part to the Layer that matches the Part's Part#layerName, or else to the default layer, which is named with the empty string.
any
Register an event handler that is called when there is a ChangedEvent.
a function that takes a ChangedEvent as its argument.
any
Register an event handler that is called when there is a DiagramEvent of a given name.
the name is normally capitalized, but this method uses case-insensitive comparison.
a function that takes a DiagramEvent as its argument.
any
Adds a Layer to the list of layers.
The Layer to add.
any
Adds a layer to the list of layers after a specified layer.
any
Adds a layer to the list of layers before a specified layer.
any
Aligns the Diagram's #position based on a desired document Spot and viewport Spot.
any
Modifies the #position to show a given Rect of the Diagram by centering the viewport on that Rect.
any
Removes all Parts from the Diagram, including unbound Parts and the background grid, and also clears out the Model and UndoManager.
any
Deselect all selected Parts.
any
Commit the changes of the current transaction.
a descriptive name for the transaction.
boolean
This is called during a Diagram update to determine a new value for #documentBounds.
Find the union of the GraphObject#actualBounds of all of the Parts in the given collection.
a collection of Parts.
Updates the diagram immediately, then resets initialization flags so that actions taken in the argument function will be considered part of Diagram initialization, and will participate in initial layouts, #initialAutoScale, #initialContentAlignment, etc.
an optional function of actions to perform as part of another diagram initialization.
any
Finds a layer with a given name.
Look for a Link corresponding to a GraphLinksModel's link data object.
Look for a Node or Group corresponding to a model's node data object.
Look for a Node or Group corresponding to a model's node data object's unique key.
a string or number.
Find the front-most GraphObject at the given point in document coordinates.
A Point in document coordinates.
A function taking a GraphObject and returning a GraphObject, defaulting to the identity.
A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true.
Return a collection of the GraphObjects at the given point in document coordinates.
A Point in document coordinates.
A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.
A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true.
An optional collection (List or Set) to add the results to.
Returns a collection of all GraphObjects that are inside or that intersect a given Rect in document coordinates.
A Rect in document coordinates.
A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.
A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true.
Whether an object can match if it merely intersects the rectangular area (true) or if it must be entirely inside the rectangular area (false). The default value is false.
An optional collection (List or Set) to add the results to.
Returns a collection of all GraphObjects that are within a certain distance of a given point in document coordinates.
A Point in document coordinates.
The distance from the point.
A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.
A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true.
Whether an object can match if it merely intersects the circular area (true) or if it must be entirely inside the circular area (false). The default value is true. The default is true.
An optional collection (List or Set) to add the results to.
This convenience function finds the front-most Part that is at a given point and that might be selectable.
a Point in document coordinates.
Whether to only consider parts that are Part#selectable.
Look for a Part, Node, Group, or Link corresponding to a Model's data object.
Look for a Part or Node or Group corresponding to a model's data object's unique key.
a string or number.
Returns an iterator of all Groups that are at top-level, in other words that are not themselves inside other Groups.
Returns an iterator of all top-level Nodes that have no tree parents.
Explicitly bring focus to the Diagram's canvas.
any
This static method gets the Diagram that is attached to an HTML DIV element.
This static function declares that a class (constructor function) derives from another class -- but please note that most classes do not support inheritance.
any
Perform all invalid layouts.
If true, this will explicitly set Layout#isValidLayout to false on each Layout in the diagram.
any
Create an HTMLImageElement that contains a bitmap of the current Diagram.
For details see the argument description of #makeImageData.
HTMLImageElement
Create a bitmap of the current Diagram encoded as a base64 string.
string
any
Remove all of the Parts created from model data and then create them again.
any
Removes a Part from its Layer, provided the Layer is in this Diagram.
any
Unregister an event handler listener.
a function that takes a ChangedEvent as its argument.
any
Unregister a DiagramEvent handler.
the name is normally capitalized, but this method uses case-insensitive comparison.
a function that takes a DiagramEvent as its argument.
any
Removes the given layer from the list of layers.
any
any
Rollback the current transaction, undoing any recorded changes.
boolean
Scrolling function used by primarily by #commandHandler's CommandHandler#doKeyDown.
A string representing the unit of the scroll operation. Can be 'pixel', 'line', or 'page'.
The direction of the scroll operation. Can be 'up', 'down', 'left', or 'right'.
An optional distance multiplier, for multiple pixels, lines, or pages. Default is 1.
any
Modifies the #position to show a given Rect of the Diagram by centering the viewport on that Rect.
any
Make the given object the only selected object.
a GraphObject that is already in a layer of this Diagram. If the value is null, this does nothing.
any
Select all of the Parts supplied in the given collection.
a List or Set of Parts to be selected.
any
Begin a transaction, where the changes are held by a Transaction object in the UndoManager.
a descriptive name for the transaction.
boolean
Given a Point in document coordinates, return a new Point in viewport coordinates.
Given a point in viewport coordinates, return a new point in document coordinates.
Update all of the data-bound properties of Nodes and Links in this diagram.
any
Scales the Diagram to uniformly fit into the viewport.
any
Modifies the #scale and #position of the Diagram so that the viewport displays a given document-coordinates rectangle.
rectangular bounds in document coordinates.
an optional value of either #Uniform (the default) or #UniformToFill.
any