Diagram$Typings extension

on

Properties

allowClipboard bool
Gets or sets whether the user may copy to or paste parts from the internal clipboard. This allows use of CommandHandler#cutSelection, CommandHandler#copySelection and CommandHandler#pasteSelection. The initial value is true.
getter/setter pair
allowCopy bool
Gets or sets whether the user may copy objects. The initial value is true.
getter/setter pair
allowDelete bool
Gets or sets whether the user may delete objects from the Diagram. The initial value is true.
getter/setter pair
allowDragOut bool
Gets or sets whether the user may start a drag-and-drop in this Diagram, possibly dropping in a different element. The initial value is false.
getter/setter pair
allowDrop bool
Gets or sets whether the user may end a drag-and-drop operation in this Diagram. This is typically set to true when a Diagram is used with a Palette.
getter/setter pair
allowGroup bool
Gets or sets whether the user may group parts together. The initial value is true.
getter/setter pair
allowHorizontalScroll bool
Gets or sets whether the user is allowed to use the horizontal scrollbar. The initial value is true.
getter/setter pair
allowInsert bool
Gets or sets whether the user may add parts to the Diagram. The initial value is true.
getter/setter pair
Gets or sets whether the user may draw new links. The initial value is true.
getter/setter pair
allowMove bool
Gets or sets whether the user may move objects. The initial value is true.
getter/setter pair
Gets or sets whether the user may reconnect existing links. The initial value is true.
getter/setter pair
allowReshape bool
Gets or sets whether the user may reshape parts. The initial value is true.
getter/setter pair
allowResize bool
Gets or sets whether the user may resize parts. The initial value is true.
getter/setter pair
allowRotate bool
Gets or sets whether the user may rotate parts. The initial value is true.
getter/setter pair
allowSelect bool
Gets or sets whether the user may select objects. The initial value is true.
getter/setter pair
allowTextEdit bool
Gets or sets whether the user may do in-place text editing. The initial value is true.
getter/setter pair
allowUndo bool
Gets or sets whether the user may undo or redo any changes. The initial value is true.
getter/setter pair
allowUngroup bool
Gets or sets whether the user may ungroup existing groups. The initial value is true.
getter/setter pair
allowVerticalScroll bool
Gets or sets whether the user is allowed to use the vertical scrollbar. The initial value is true.
getter/setter pair
allowZoom bool
Gets or sets whether the user may zoom into or out of the Diagram. The initial value is true.
getter/setter pair
animationManager AnimationManager
This read-only property returns the AnimationManager for this Diagram.
getter/setter pair
autoScale EnumValue
Gets or sets the autoScale behavior of the Diagram, controlling whether or not the Diagram's bounds automatically scale to fit the view.
getter/setter pair
autoScrollInterval num
Gets or sets number of milliseconds between autoscroll events. The default value is 250.
getter/setter pair
autoScrollRegion Object
Gets or sets the Margin that describes the area along the inside edges of the viewport, in viewport coordinates, where autoscrolling will occur while the mouse (pointer) is held there during dragging or linking or drag-selecting.
getter/setter pair
avoidanceCellSize Size
(undocumented)
getter/setter pair
avoidanceLimit num
(undocumented)
getter/setter pair
click ↔ void Function(InputEvent)?
Gets or sets the function to execute when the user single-primary-clicks on the background of the Diagram. This typically involves a mouse-down followed by a prompt mouse-up at approximately the same position using the left (primary) mouse button. This property is used by the ClickSelectingTool when the user clicks on no object. The function is called in addition to the DiagramEvent that is raised with the name "BackgroundSingleClicked".
getter/setter pair
commandHandler CommandHandler
Gets or sets the CommandHandler for this Diagram.
getter/setter pair
contentAlignment Spot
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 larger than the #documentBounds.
getter/setter pair
contextClick ↔ void Function(InputEvent)?
Gets or sets the function to execute when the user single-secondary-clicks on the background of the Diagram. This typically involves a mouse-down followed by a prompt mouse-up at approximately the same position using the right (secondary) mouse button. This property is used by the ClickSelectingTool when the user clicks on no object. The function is called in addition to the DiagramEvent that is raised with the name "BackgroundContextClicked".
getter/setter pair
contextMenu ↔ dynamic
This Adornment or HTMLInfo is shown when the use context clicks in the background. The default value is null, which means no context menu is shown. On touch devices, a special default context menu will appear even there is no context menu defined. See ContextMenuTool#defaultTouchContextMenu for details.
getter/setter pair
currentCursor String
Gets or sets the current cursor for the Diagram, overriding the #defaultCursor.
getter/setter pair
currentTool Tool
Gets or sets the current tool for this Diagram that handles all input events. This value is frequently replaced by the #toolManager as different tools run.
getter/setter pair
defaultCursor String
Gets or sets the cursor to be used for the Diagram when no GraphObject specifies a different cursor.
getter/setter pair
defaultScale num
Gets or sets the Diagram#scale set by CommandHandler#resetZoom and when computing stretch values, such as when #autoScale or #initialAutoScale are set, or when #zoomToFit is called.
getter/setter pair
defaultTool Tool
Gets or sets the default tool for this Diagram that becomes the current tool when the current tool stops. Initially this value is the same tool as #toolManager, which is an instance of ToolManager.
getter/setter pair
delaysLayout bool
(undocumented) When set to true Diagram layouts will not get invalidated. Used by some tools stop real-time layouts from occuring during their operation.
getter/setter pair
div HTMLDivElement?
Gets or sets the Diagram's HTMLDivElement, via an HTML Element ID. This is typically set automatically when a Div is supplied as an argument to Diagram's constructor.
getter/setter pair
documentBounds Rect
This read-only property returns the bounds of the diagram's contents, in document coordinates.
getter/setter pair
doubleClick ↔ void Function(InputEvent)?
Gets or sets the function to execute when the user double-primary-clicks on the background of the Diagram. This typically involves a mouse-down/up/down/up in rapid succession at approximately the same position using the left (primary) mouse button. This property is used by the ClickSelectingTool when the user clicks on no object. The function is called in addition to the DiagramEvent that is raised with the name "BackgroundDoubleClicked".
getter/setter pair
firstInput InputEvent
Gets or sets the most recent mouse-down InputEvent that occurred.
getter/setter pair
fixedBounds Rect
Gets or sets a fixed bounding rectangle to be returned by #documentBounds and #computeBounds. By default this has NaN values, meaning that #computeBounds will compute the union of all of the parts in the Diagram to determine the #documentBounds. If all x/y/width/height values are real numbers, this value is used as the #documentBounds.
getter/setter pair
grid Panel
Gets or sets a Panel of type Panel.Grid acting as the background grid extending across the whole viewport of this diagram.
getter/setter pair
groupSelectionAdornmentTemplate Adornment
Gets or sets the default selection Adornment template, used to adorn selected Groups.
getter/setter pair
groupTemplate Group
Gets or sets the default Group template used as the archetype for group data that is added to the #model.
getter/setter pair
groupTemplateMap Map<String, Group>
Gets or sets a Map mapping template names to Groups. These groups are copied for each group data that is added to the #model.
getter/setter pair
handlesDragDropForTopLevelParts bool
Gets or sets whether drag-and-drop events may be bubbled up to the diagram if not handled by a part. The default value is false -- each Node or Link that in the diagram needs to define its own GraphObject#mouseDragEnter, GraphObject#mouseDragLeave, and GraphObject#mouseDrop event handlers if you want dragging/dropping on a part to act as if the user were acting on the diagram.
getter/setter pair
hasHorizontalScrollbar bool
Gets or sets whether the Diagram has a horizontal Scrollbar.
getter/setter pair
hasVerticalScrollbar bool
Gets or sets whether the Diagram has a vertical Scrollbar.
getter/setter pair
highlighteds Set<Part>
This read-only property returns the read-only collection of highlighted parts.
getter/setter pair
initialAutoScale EnumValue
Gets or sets how the scale of the diagram is automatically set at the time of the "InitialLayoutCompleted" DiagramEvent, after the model has been replaced.
getter/setter pair
initialContentAlignment Spot
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, when the #viewportBounds width or height is larger than the #documentBounds.
getter/setter pair
initialDocumentSpot Spot
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. The default value is Spot.TopLeft.
getter/setter pair
initialPosition Point
Gets or sets the initial coordinates of this Diagram in the viewport, eventually setting the #position. This value is relevant on initialization of a #model or if #delayInitialization is called. Value must be of type Point in document coordinates. The default is Point(NaN, NaN).
getter/setter pair
initialScale num
Gets or sets the initial scale of this Diagram in the viewport, eventually setting the #scale. This value is relevant on initialization of a #model or if #delayInitialization is called. The default is NaN.
getter/setter pair
initialViewportSpot Spot
Gets or sets the spot in the viewport that should be coincident with the #initialDocumentSpot of the document when the document is first initialized. The default value is Spot.TopLeft.
getter/setter pair
isEnabled bool
Gets or sets whether the user may interact with the Diagram.
getter/setter pair
isModelReadOnly bool
Gets or sets whether the Diagram's Diagram#model is Model#isReadOnly.
getter/setter pair
isModified bool
Gets or sets whether this Diagram's state has been modified. Setting this property does not notify about any changed event, but it does raise the "Modified" DiagramEvent, although perhaps not immediately.
getter/setter pair
isMouseCaptured bool
Gets or sets whether mouse events initiated within the Diagram will be captured. The initial value is true. Setting this property does not notify about any changed event.
getter/setter pair
isReadOnly bool
Gets or sets whether the Diagram may be modified by the user, while still allowing the user to scroll, zoom, and select. The initial value is false.
getter/setter pair
isTreePathToChildren bool
Gets or sets whether the Diagram tree structure is defined by links going from the parent node to their children, or vice-versa. By default this property is true: links go from the parent node to the child node.
getter/setter pair
isVirtualized bool
(undocumented)
getter/setter pair
lastInput InputEvent
Gets or sets the last InputEvent that occurred.
getter/setter pair
layers Iterator<Layer>
This read-only property returns an iterator for this Diagram's Layers.
getter/setter pair
layout Layout
Gets or sets the Layout used to position all of the top-level nodes and links in this Diagram. By default this property is an instance of a simple Layout that assigns positions to all parts that need it. The value cannot be null and must not be shared with other Diagrams.
getter/setter pair
This read-only property returns an iterator of all Links in the Diagram.
getter/setter pair
linkSelectionAdornmentTemplate Adornment
Gets or sets the default selection Adornment template, used to adorn selected Links.
getter/setter pair
linkTemplate Link
Gets or sets the default Link template used as the archetype for link data that is added to the #model.
getter/setter pair
linkTemplateMap Map<String, Link>
Gets or sets a Map mapping template names to Links. These links are copied for each link data that is added to the #model.
getter/setter pair
maxScale num
Gets or sets the largest value that #scale may take. This property is only used to limit the range of new values of #scale.
getter/setter pair
maxSelectionCount num
Gets or sets the maximum number of selected objects. The default value is a large positive integer. Values must be non-negative. Decreasing this value may cause objects to be removed from #selection in order to meet the new lower limit.
getter/setter pair
minScale num
Gets or sets the smallest value greater than zero that #scale may take. This property is only used to limit the range of new values of #scale.
getter/setter pair
model Model
Gets or sets the Model holding data corresponding to the data-bound nodes and links of this Diagram.
getter/setter pair
mouseDragOver ↔ void Function(InputEvent)?
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.
getter/setter pair
mouseDrop ↔ void Function(InputEvent)?
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.
getter/setter pair
mouseEnter ↔ void Function(InputEvent)?
Gets or sets the function to execute when the mouse (pointer) enters the Diagram. (When the browser's mouseEnter event fires on the Diagram canvas.)
getter/setter pair
mouseHold ↔ void Function(InputEvent)?
Gets or sets the function to execute when the user holds the mouse (pointer) stationary in the background of the Diagram while holding down a button, not over any GraphObjects. This property is used by the ToolManager.
getter/setter pair
mouseHover ↔ void Function(InputEvent)?
Gets or sets the function to execute when the user holds the mouse (pointer) stationary in the background of the Diagram without holding down any buttons, not over any GraphObjects. This property is used by the ToolManager.
getter/setter pair
mouseLeave ↔ void Function(InputEvent)?
Gets or sets the function to execute when the mouse (pointer) leaves the Diagram.
getter/setter pair
mouseOver ↔ void Function(InputEvent)?
Gets or sets the function to execute when the user moves the mouse (pointer) in the background of the Diagram without holding down any buttons, not over any GraphObjects. This property is used by the ToolManager.
getter/setter pair
nodes Iterator<Node>
This read-only property returns an iterator of all Nodes and Groups in the Diagram.
getter/setter pair
nodeSelectionAdornmentTemplate Adornment
Gets or sets the default selection Adornment template, used to adorn selected Parts other than Groups or Links.
getter/setter pair
nodeTemplate Part
Gets or sets the default Node template used as the archetype for node data that is added to the #model. Setting this property just modifies the #nodeTemplateMap by replacing the entry named with the empty string.
getter/setter pair
nodeTemplateMap Map<String, Part>
Gets or sets a Map mapping template names to Parts. These nodes are copied for each node data that is added to the #model.
getter/setter pair
opacity num
Gets or sets the opacity for all parts in this diagram. The value must be between 0.0 (fully transparent) and 1.0 (no additional transparency). This value is multiplicative with any existing transparency, for instance from a Brush or image transparency. The default value is 1.
getter/setter pair
padding Object
Gets or sets the Margin that describes the Diagram's padding, which controls how much extra space in document coordinates there is around the area occupied by the document. This keeps nodes from butting up against the side of the diagram (unless scrolled).
getter/setter pair
parts Iterator<Part>
This read-only property returns an iterator of all Parts in the Diagram that are not Nodes or Links or Adornments.
getter/setter pair
position Point
Gets or sets the coordinates of this Diagram in the viewport. Value must be of type Point in document coordinates. The default is Point(NaN, NaN), but is typically set to a real value when a Diagram is initialized.
getter/setter pair
positionComputation Point Function(Diagram, Point)?
Gets or sets the function used to determine the position that this Diagram can be scrolled or moved to.
getter/setter pair
renderer Renderer
Gets or sets the rendering context type. Values are 'default', which uses the HTML Canvas, or 'svg', which builds and updates an SVG DOM.
getter/setter pair
scale num
Gets or sets the scale transform of this Diagram. Value must be a positive number. The default value is 1. Any new value will be coerced to be between #minScale and #maxScale.
getter/setter pair
scaleComputation num Function(Diagram, num)?
Gets or sets the function used to determine valid scale values for this Diagram.
getter/setter pair
scrollHorizontalLineChange num
Gets or sets the distance in screen pixels that the horizontal scrollbar will scroll when scrolling by a line.
getter/setter pair
scrollMargin Object
Gets or sets a scrollable area in document coordinates that surrounds the document bounds, allowing the user to scroll into empty space.
getter/setter pair
scrollMode EnumValue
Gets or sets the scrollMode of the Diagram, allowing the user to either scroll to document bound borders with Diagram.DocumentScroll, or scroll endlessly with Diagram.InfiniteScroll.
getter/setter pair
scrollsPageOnFocus bool
Gets or sets whether the page may be scrolled when the diagram receives focus. This happens in some browsers when the top-left corner of the diagram's HTMLDivElement is scrolled out of view, the diagram does not have focus, and the user clicks in the diagram.
getter/setter pair
scrollVerticalLineChange num
Gets or sets the distance in screen pixels that the vertical scrollbar will scroll when scrolling by a line.
getter/setter pair
selection Set<Part>
This read-only property returns the read-only collection of selected objects. Most commands and many tools operate on this collection.
getter/setter pair
skipsUndoManager bool
Gets or sets whether ChangedEvents are not recorded by the UndoManager. The initial and normal value is false. WARNING: while this property is true do not perform any changes that cause any previous transactions to become impossible to undo.
getter/setter pair
toolManager ToolManager
Gets or sets the ToolManager for this Diagram. This tool is used for mode-less operation. It is responsible for choosing a particular tool to run as the #currentTool.
getter/setter pair
toolTip ↔ dynamic
This Adornment or HTMLInfo is shown when the mouse (pointer) stays motionless in the background. The default value is null, which means no tooltip is shown.
getter/setter pair
undoManager UndoManager
This read-only property returns the UndoManager for this Diagram, which actually belongs to the #model.
getter/setter pair
validCycle EnumValue
Gets or sets what kinds of graphs this diagram allows the user to draw. By default this property is Diagram.CycleAll -- all kinds of cycles are permitted. Common values include Diagram.CycleDestinationTree and Diagram.CycleNotDirected.
getter/setter pair
viewportBounds Rect
This read-only property returns the bounds of the portion of the Diagram in document coordinates that is viewable from its HTML Canvas. Typically when the viewport bounds are smaller than the #documentBounds, the user can scroll or pan the view.
getter/setter pair
viewSize Size
Gets or sets a fixed size in document coordinates to be returned by #viewportBounds. This is typically only set when the Diagram's #div is null. This property is intended to be used in DOM-less environments where there is no Diagram #div expected, to simulate the size of the DIV. Normally, the #viewportBounds is sized by the DIV instead.
getter/setter pair
zoomPoint Point
Gets or sets the zoom point of this Diagram, in viewport coordinates. This is used by Tool#standardMouseWheel and scale-setting commands to control where to zoom in or out.
getter/setter pair

Methods

add(Part part) → void
Adds a Part to the Layer that matches the Part's Part#layerName, or else the default layer, which is named with the empty string.
addChangedListener(void listener(ChangedEvent)) Diagram
Register an event handler that is called when there is a ChangedEvent because this Diagram or one of its Parts has changed, but not because the Model or any model data has changed.
addDiagramListener(DiagramEventName name, void listener(DiagramEvent)) Diagram
Register an event handler that is called when there is a DiagramEvent of a given name.
addEventListener(EventTarget domElement, String name, bool capture, [dynamic listener]) → void
(undocumented), but may be useful for change detection calls in Angular. @expose
addLayer(Layer layer) Diagram
Adds a new Layer to the list of layers. If Layer#isTemporary is false, the layer is added after all existing non-temporary layers. If Layer#isTemporary is true, the layer is added as the very last layer. @param {Layer} layer The new Layer to add. It is an error if the Layer already belongs to a Diagram. @see #addLayerBefore @see #addLayerAfter @see #removeLayer @see #findLayer @return {Diagram} this Diagram
addLayerAfter(Layer layer, Layer existingLayer) Diagram
Adds a layer to the list of layers after a specified layer. This method can also re-order layers. @param {Layer} layer the new Layer to add or existing Layer to move in Z-order. @param {Layer} existingLayer the other Layer in this Diagram which should come just before the new or moved layer. @see #addLayer @see #addLayerBefore @see #removeLayer @return {Diagram} this Diagram
addLayerBefore(Layer layer, Layer existingLayer) Diagram
Adds a layer to the list of layers before a specified layer. This method can also re-order layers. @param {Layer} layer the new Layer to add or existing Layer to move in Z-order. @param {Layer} existingLayer the other Layer in this Diagram which should come just after the new or moved layer. @see #addLayer @see #addLayerAfter @see #removeLayer @return {Diagram} this Diagram
addModelChangedListener(void listener(ChangedEvent)) Diagram
Register an event handler on this Diagram's Diagram#model that is called when there is a ChangedEvent on the Model, not in this diagram. Be sure to call #removeModelChangedListener when you are done with the diagram.
addRenderer(String name, ISurface surface) → void
(undocumented) Add a renderer to the Diagram. This property is only used when building GoJS from source.
alignDocument(Spot documentspot, Spot viewportspot) → void
Aligns the Diagram's #position based on a desired document Spot and viewport Spot. @param {Spot} documentspot @param {Spot} viewportspot
attach(Object props) Diagram
This method sets a collection of properties according to the property/value pairs that have been set on the given Object, in the same manner as GraphObject.make does when constructing a Diagram with an argument that is a simple JavaScript Object.
(undocumented) Start or stop caching Group.findExternalLinksConnected
centerRect(Rect r) → void
Modifies the #position to show a given Rect of the Diagram by centering the viewport on that Rect.
clear() → void
Removes all Parts from the Diagram, including unbound Parts except for the background grid, and also clears out the Model and UndoManager and clipboard. This operation is not undoable.
clearHighlighteds() → void
Remove highlights from all Parts. This removes all parts from the #highlighteds collection.
clearSelection([bool? skipsEvents]) → void
Deselect all selected Parts. This removes all parts from the #selection collection.
commit(void func(Diagram), [String? tname]) → void
Starts a new transaction, calls the provided function, and commits the transaction. Code is called within a try-finally statement. If the function does not return normally, this rolls back the transaction rather than committing it. Example usage:
commitTransaction([String? tname]) bool
Commit the changes of the current transaction. This just calls UndoManager#commitTransaction. @param {string=} tname a descriptive name for the transaction. @return {boolean} the value returned by UndoManager#commitTransaction.
computeAutoScrollPosition(Point viewPnt) Point
(undocumented) @expose @param {Point} viewPnt in viewport coordinates @return {Point} in document coordinates
computeBounds([Rect? rect]) Rect
This is called during a Diagram update to determine a new value for #documentBounds. By default this computes the union of the bounds of all the visible GraphObjects in this Diagram, unless Diagram#fixedBounds is set. This ignores parts for which Part#isVisible is false and ignores those for which Part#isInDocumentBounds is false. The returned value includes the addition of the #padding margin.
computeMove(Part n, Point newloc, DraggingOptions dragOptions, [Point? result]) Point
This method computes the new location for a Node or simple Part, given a new desired location, taking any grid-snapping into consideration, any Part#dragComputation function, and any Part#minLocation and Part#maxLocation.
computePartsBounds(Object coll, [bool? includeLinks]) Rect
Find the union of the GraphObject#actualBounds of all of the Parts in the given collection, excluding Links unless the second argument is true.
computePixelRatio() num
(undocumented) Computes the device pixel ratio divided by the backing store pixel ratio Used to set this._pixelRatio to a value other than 1. @expose @return {number}
copyParts(Object coll, [Diagram? diagram, bool? check]) Map<Part, Part>
Make a copy of a collection of Parts and return them in a Map mapping each original Part to its copy. It may optionally add them to a given Diagram. Copying a Group will also copy its member Nodes and Links. Copying a Link will also copy any label Nodes that it owns.
delayInitialization([void func([Diagram?])?]) → void
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.
doAutoScroll(Point viewPt) → void
(undocumented) Called by DraggingTool and LinkingTool to implement auto-scrolling. @param {Point} viewPt
doFocus() → void
(undocumented) Focus the Diagram's canvas, allowing it to receive keyboard events. This is called upon activation of mouseDown or mouseMove tools, or on any mouseUp.
ensureBounds() → void
Ensures that the #documentBounds are up to date. This is sometimes necessary when operations need updated document bounds immediately.
findLayer(String name) Layer?
Finds a layer with a given name. @param {string} name @return {Layer} a Layer with the given name, or null if no such layer was found. @see #addLayerBefore @see #addLayerAfter @see #removeLayer
findLinkForData(Object linkdata) Link?
Look for a Link corresponding to a GraphLinksModel's link data object. @param {Object} linkdata a JavaScript object matched by reference identity; use #findLinksByExample if you want to find those Links whose data matches an example data object @return {Link} an existing Link in this Diagram that was created because its Part.data was the link data in the Diagram's Model.
findLinkForKey(dynamic key) Link?
Look for a Link corresponding to a model's link data object's unique key. @param {(string|number|undefined)} key a string or number. @return {Link} null if a link data with that key cannot be found in the model, or if a corresponding Link cannot be found in the Diagram, or if the model is a GraphLinksModel without GraphLinksModel#linkKeyProperty set to a non-empty string. @since 2.1
findLinksByExample([Iterable? examples]) Iterator<Link>
Search for Links by matching the Link data with example data holding values, RegExps, or predicates.
findNodeForData(Object nodedata) Node?
Look for a Node or Group corresponding to a model's node data object. @param {Object} nodedata a JavaScript object matched by reference identity; use #findNodesByExample if you want to find those Nodes whose data matches an example data object @return {Node} an existing Node or Group in this Diagram that was created because its Part.data was the node data in the Diagram's Model. This will be null if there is no such part or if it's just a Part or Link.
findNodeForKey(dynamic key) Node?
Look for a Node or Group corresponding to a model's node data object's unique key. @param {(string|number|undefined)} key a string or number. @return {Node} null if a node data with that key cannot be found in the model, or if a corresponding Node or Group cannot be found in the Diagram, or if what is found is just a Part.
findNodesByExample([Iterable? examples]) Iterator<Node>
Search for Nodes or Groups by matching the Node data with example data holding values, RegExps, or predicates.
findObjectAt<T extends GraphObject>(Point p, [T? navig(GraphObject)?, bool pred(T)?]) → T?
Find the front-most GraphObject at the given point in document coordinates.
findObjectsAt<T extends GraphObject, S extends Iterable<T>>(Point p, [T? navig(GraphObject)?, bool pred(T)?, S? coll]) → S
Return a collection of the GraphObjects at the given point in document coordinates.
findObjectsIn<T extends GraphObject, S extends Iterable<T>>(Rect r, [T? navig(GraphObject)?, bool pred(T)?, bool? partialInclusion, S? coll]) → S
Returns a collection of all GraphObjects that are inside or that intersect a given Rect in document coordinates.
findObjectsNear<T extends GraphObject, S extends Iterable<T>>(Point p, num dist, [T? navig(GraphObject)?, bool pred(T)?, Object? partialInclusion, S? coll]) → S
Returns a collection of all GraphObjects that are within a certain distance of a given point in document coordinates.
findPartAt(Point p, [bool? selectable]) Part?
This convenience function finds the front-most Part that is at a given point that might be selectable and that is not in a temporary layer.
findPartForData(Object data) Part?
Look for a Part, Node, Group, or Link corresponding to a Model's data object. We recommend that you call #findNodeForData or #findLinkForData if you are looking for a Node or a Link. @param {Object} data a JavaScript object matched by reference identity @return {Part} an existing Part in this Diagram that was created because its Part.data was the data in the Diagram's Model.
findPartForKey(dynamic key) Part?
Look for a Part or Node or Group corresponding to a model's data object's unique key. This will find a Link if the model is a GraphLinksModel that is maintaining a key on the link data objects. @param {(string|number|undefined)} key a string or number. @return {Part} null if a data with that key cannot be found in the model, or if a corresponding Part cannot be found in the Diagram. This will not return a Link unless the model is a GraphLinksModel and GraphLinksModel#linkKeyProperty has been set. If the same key is used for both a node data object and a link data object, this will return a Node.
findPartsAt<T extends Part, S extends Iterable<T>>(Point p, [bool? selectable, S? coll]) → S
This convenience function finds all Parts that are at a point in document coordinates and that are not in temporary layers.
findPartsIn<T extends Part, S extends Iterable<T>>(Rect r, [bool? partialInclusion, bool? selectable, S? coll]) → S
This convenience function finds Parts that are inside or that intersect a given Rect in document coordinates.
findPartsNear<T extends Part, S extends Iterable<T>>(Point p, num dist, [bool? partialInclusion, bool? selectable, S? coll]) → S
This convenience function finds Parts that are within a certain distance of a given point in document coordinates.
findTopLevelGroups() Iterator<Group>
Returns an iterator of all Groups that are at top-level, in other words that are not themselves inside other Groups.
findTreeRoots() Iterator<Node>
Returns an iterator of all top-level Nodes that have no tree parents.
focus() → void
Explicitly bring HTML focus to the Diagram's canvas. This is called by tools that may create other HTML elements such as TextEditingTool.
focusObject([GraphObject? obj]) → void
(undocumented) Sets the GraphObject on which to focus the viewport. @param {GraphObject | null} obj @since 2.1
getInputOption(String name) → dynamic
(undocumented) Get value of a given input option @param {string} name @return {*}
getRenderingHint(String name) → dynamic
(undocumented) Get value of a given rendering hint. @param {string} name @return {*}
highlight([Part? part]) → void
Make the given part the only highlighted part. Afterwards the #highlighteds collection will have only the given part in it.
highlightCollection(Object coll) → void
Highlight all of the Parts supplied in the given collection, and unhighlight all other highlighted Parts.
invalidateDocumentBounds() → void
(undocumented) Requests that the Diagram updates its #documentBounds in the near-future.
layoutDiagram([bool? invalidateAll]) → void
Perform all invalid layouts. If the optional argument is true, this will perform all of the layouts (Diagram#layout and all Group#layouts), not just the invalid ones.
makeImage([ImageRendererOptions? options]) HTMLImageElement?
Create an HTMLImageElement that contains a bitmap of the current Diagram. This method is just a convenience function that creates an image, sets its source to the returned string of #makeImageData, and returns a reference to that Image.
makeImageData([ImageRendererOptions? options]) → dynamic
Create a bitmap of the current Diagram encoded as a base64 string, or returned as an ImageData object. This method uses the toDataURL method of the HTMLCanvasElement to create the data URL, or the getImageData method of the Canvas Context. Unlike toDataURL, this method will not throw an error if cross-domain images were drawn on the canvas, instead it will return a data URL of a bitmap with those images omitted.
makeSvg([SvgRendererOptions? options]) SVGElement?
Create an SVGElement that contains a SVG rendering of the current Diagram.
maybeUpdate() → void
(undocumented) The use of this method at the wrong time may have some unexpected side-effects.
moveParts(Object coll, Point offset, [bool? check, DraggingOptions? dragOptions]) → void
Move a collection of Parts in this Diagram by a given offset. Moving a Group will also move its member Nodes and Links. Moving with a zero X and a zero Y offset is potentially useful in order to snap Parts to the grid if DraggingTool#isGridSnapEnabled is true.
raiseDiagramEvent(DiagramEventName name, [Object? obj, dynamic param]) → void
(undocumented) Notify any DiagramEvent listeners by calling all event handlers registered by #addDiagramListener. @param {string} name the name is normally capitalized, but this method uses case-insensitive comparison. @param {Object=} obj an optional subject of the event. @param {*=} param an optional parameter describing the change to the subject of the event. @see #addDiagramListener @see #removeDiagramListener
rebuildParts() → void
Remove all of the Parts created from model data and then create them again. This must be called after modifying or replacing any of the template maps such as #nodeTemplateMap. This re-selects all of the new Parts that were created from data of the original selected Parts.
redraw() → void
(undocumented) Invalidates all non-layout diagram state and forces an immediate redraw. Because this can be very inefficient, to discourage its use it remains an undocumented part of the API. @expose
remove(Part part) → void
Removes a Part from its Layer, provided the Layer is in this Diagram. Removing a Node will also remove any Links that are connected with it. Removing a Group will also remove all of its members. Removing a Link will also remove all of its label Nodes, if it has any. @param {Part} part @see #add
removeChangedListener(void listener(ChangedEvent)) → void
Unregister a ChangedEvent handler. The function argument must be the same reference as was passed to #addChangedListener. @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument. @see #addChangedListener
removeDiagramListener(DiagramEventName name, void listener(DiagramEvent)) → void
Unregister a DiagramEvent handler.
removeEventListener(EventTarget domElement, String name, bool capture, [dynamic listener]) → void
(undocumented), but may be useful for change detection calls in Angular. @expose
removeLayer(Layer layer) → void
Removes the given layer from the list of layers.
removeModelChangedListener(void listener(ChangedEvent)) → void
Unregister a ChangedEvent handler from this Diagram's Diagram#model. The function argument must be the same reference as was passed to #addChangedListener. @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument. @see #addModelChangedListener @since 1.6
removeParts(Object coll, [bool? check]) → void
This method removes from this Diagram all of the Parts in a collection. Removing a Node will also remove any Links that are connected with it. Removing a Group will also remove all of its members. Removing a Link will also remove all of its label Nodes, if it has any.
requestUpdate([bool? alwaysQueueUpdate]) → void
Usage of this method is uncommon and may affect performance, for efficiency do not call this method unless you have a well-defined need. Normally, GoJS updates the diagram automatically, and completeing a transaction ensures an immediate update.
reset() → void
(undocumented) Call #clear and also restore the templates, layers, layout and various Diagram properties to their original state. @expose
rollbackTransaction() bool
Rollback the current transaction, undoing any recorded changes. This just calls UndoManager#rollbackTransaction. @return {boolean} the value returned by UndoManager#rollbackTransaction.
scroll(Scroll unit, ScrollOptions dir, [num? dist]) → void
Scrolling function used by primarily by #commandHandler's CommandHandler#doKeyDown. @param {string} unit A string representing the unit of the scroll operation. Can only be 'pixel', 'line', 'page', or 'document'. @param {string} dir The direction of the scroll operation. Can only be 'up', 'down', 'left', or 'right'. @param {number=} dist An optional distance multiplier, for multiple pixels, lines, or pages. The default value is 1. This argument is ignored when the unit is 'document'. @see #scrollToRect @see #centerRect
scrollToRect(Rect r) → void
Modifies the #position to show a given Rect of the Diagram by centering the viewport on that Rect. Does nothing if the Rect is already entirely in view.
select([Part? part]) → void
Make the given object the only selected object. Afterwards the #selection collection will have only the given part in it.
selectCollection(Object coll) → void
Select all of the Parts supplied in the given collection, and deselect all other Parts.
set(dynamic config) Diagram
Set any number of properties on this Diagram. This is common in initialization. This method can only be used to set existing properties on this object. To attach new properties, or to set properties of sub-objects such as the Diagram#toolManager, Diagram#animationManager, or Diagram#commandHandler, use Diagram#attach.
setInputOption(String name, [dynamic val]) → void
(undocumented) Set value of a given input option @param {string} name @param {*} val
setProperties(Object props) Diagram
This method sets a collection of properties according to the property/value pairs that have been set on the given Object, in the same manner as GraphObject.make does when constructing a Diagram with an argument that is a simple JavaScript Object.
setRenderingHint(String name, [dynamic val]) → void
(undocumented) Set a rendering hint and draw immediately. @param {string} name @param {*} val
setRTL([HTMLElement? elem]) → void
@expose (undocumented) Used in Diagram constructor setup, this computes the pixel width of the scrollbars @param {HTMLElement=} elem
setScrollWidth([HTMLElement? elem]) → void
(undocumented) Computes the pixel width of the scrollbars @expose @param {HTMLElement=} elem
startTransaction([String? tname]) bool
Begin a transaction, where the changes are held by a Transaction object in the UndoManager. This just calls UndoManager#startTransaction. @param {string=} tname a descriptive name for the transaction. @return {boolean} the value returned by UndoManager#startTransaction. @see #commit
stopAutoScroll() → void
(undocumented) Stop any ongoing auto-scroll action.
transformDocToView(Point p) Point
Given a Point in document coordinates, return a new Point in viewport coordinates. @param {Point} p @return {Point} The given Point converted into View coordinates. @see #transformViewToDoc @see GraphObject#getDocumentPoint
transformViewToDoc(Point p) Point
Given a point in viewport coordinates, return a new Point in document coordinates. @param {Point} p @return {Point} The given point converted into Document coordinates. @see #transformDocToView @see GraphObject#getDocumentPoint
updateAllRelationshipsFromData() → void
Add or remove any nodes or links according to additional or missing data objects in the model and update all of the references to nodes, in case they had been modified in the model without properly notifying the model by calling Model#addNodeData or GraphLinksModel#removeLinkData or GraphLinksModel#setGroupKeyForNodeData or GraphLinksModel#setToKeyForLinkData or other similar methods. This method does not conduct a transaction, so you need to start and commit one yourself.
updateAllTargetBindings([String? srcprop]) → void
Update all of the data-bound properties of Nodes and Links in this diagram, without having to call Model#setDataProperty. This copies/converts model data properties to set properties on Parts. This method does not conduct a transaction, so you need to start and commit one yourself.
zoomToFit() → void
Scales the Diagram to uniformly fit into the viewport. To have this done automatically, set the Diagram's #autoScale to Diagram.Uniform.
zoomToRect(Rect r, [EnumValue? scaling]) → void
Modifies the #scale and #position of the Diagram so that the viewport displays a given document-coordinates rectangle. @param {Rect} r rectangular bounds in document coordinates. @param {EnumValue=} scaling an optional value of either Diagram.Uniform (the default) or Diagram.UniformToFill. @since 1.1