Options
All
  • Public
  • Public/Protected
  • All
Menu

Extends mxEventSource to implement a graph component for the browser. This is the main class of the package. To activate panning and connections use setPanning and setConnectable. For rubberband selection you must create a new instance of mxRubberband. The following listeners are added to mouseListeners by default:

These listeners will be called in the above order if they are enabled.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • Parameters

    • container: HTMLElement

      Optional DOM node that acts as a container for the graph. If this is null then the container can be initialized later using init.

    • Optional model: mxGraphModel

      Optional mxGraphModel that constitutes the graph data.

    • Optional renderHint: string

      Optional string that specifies the display accuracy and performance. Default is mxConstants.DIALECT_MIXEDHTML (for IE).

    • Optional stylesheet: mxStylesheet

      Optional mxStylesheet to be used in the graph.

    Returns mxGraph

Properties

allowAutoPanning

allowAutoPanning: boolean

Specifies if panning via panGraph should be allowed to implement autoscroll if no scrollbars are available in scrollPointToVisible. To enable panning inside the container, near the edge, set mxPanningManager.border to a positive value.

default

false

allowDanglingEdges

allowDanglingEdges: boolean

Specifies if edges with disconnected terminals are allowed in the graph.

default

true

allowLoops

allowLoops: boolean

Specifies if loops (aka self-references) are allowed.

default

false

allowNegativeCoordinates

allowNegativeCoordinates: boolean

Specifies if negative coordinates for vertices are allowed.

default

true

alreadyConnectedResource

alreadyConnectedResource: string

Specifies the resource key for the error message to be displayed in non-multigraphs when two vertices are already connected. If the resource for this key does not exist then the value is used as the error message.

default

'alreadyConnected'

alternateEdgeStyle

alternateEdgeStyle: string

Specifies the alternate edge style to be used if the main control point on an edge is being double clicked.

default

null

autoExtend

autoExtend: boolean

Specifies if the size of the graph should be automatically extended if the mouse goes near the container edge while dragging. This is only taken into account if the container has scrollbars. See autoScroll.

default

true

autoScroll

autoScroll: boolean

Specifies if the graph should automatically scroll if the mouse goes near the container edge while dragging. This is only taken into account if the container has scrollbars.

If you need this to work without scrollbars then set ignoreScrollbars to true. Please consult the ignoreScrollbars for details. In general, with no scrollbars, the use of allowAutoPanning is recommended.

default

true

autoSizeCells

autoSizeCells: boolean

Specifies if the graph should automatically update the cell size after an edit. This is used in isAutoSizeCell.

default

false

autoSizeCellsOnAdd

autoSizeCellsOnAdd: boolean

Specifies if autoSize style should be applied when cells are added.

default

false

backgroundImage

backgroundImage: mxImage

Specifies the mxImage to be returned by getBackgroundImage.

default

null

example
var img = new mxImage('http://www.example.com/maps/examplemap.jpg', 1024, 768);
graph.setBackgroundImage(img);
graph.view.validate();

border

border: number

Border to be added to the bottom and right side when the container is being resized after the graph has been changed.

default

0

cellEditor

cellEditor: mxCellEditor

Holds the mxCellEditor that is used as the in-place editing.

cellRenderer

cellRenderer: mxCellRenderer

Holds the mxCellRenderer for rendering the cells in the graph.

cellsBendable

cellsBendable: boolean

Specifies the return value for isCellsBendable.

default

true

cellsCloneable

cellsCloneable: boolean

Specifies the return value for isCellCloneable.

default

true

cellsDeletable

cellsDeletable: boolean

Specifies the return value for isCellDeletable.

default

true

cellsDisconnectable

cellsDisconnectable: boolean

Specifies the return value for isCellsDisconnectable.

default

true

cellsEditable

cellsEditable: boolean

Specifies the return value for isCellEditable.

default

true

cellsLocked

cellsLocked: boolean

Specifies the return value for isCellLocked.

default

false

cellsMovable

cellsMovable: boolean

Specifies the return value for isCellMovable.

default

true

cellsResizable

cellsResizable: boolean

Specifies the return value for isCellsResizable.

default

true

cellsSelectable

cellsSelectable: boolean

Specifies the return value for isCellsSelectable.

default

true

centerZoom

centerZoom: boolean

Specifies if the zoom operations should go into the center of the actual diagram rather than going from top, left.

default

true

cloneInvalidEdges

cloneInvalidEdges: boolean

Specifies if edges that are cloned should be validated and only inserted if they are valid.

default

true

collapseExpandResource

collapseExpandResource: string

Specifies the resource key for the tooltip on the collapse/expand icon. If the resource for this key does not exist then the value is used as the tooltip.

default

'collapse-expand'

collapseToPreferredSize

collapseToPreferredSize: boolean

Specifies if the cell size should be changed to the preferred size when a cell is first collapsed.

default

true

collapsedImage

collapsedImage: mxImage

Specifies the mxImage to indicate a collapsed state. Default value is mxClient.imageBasePath + '/collapsed.gif'

connectableEdges

connectableEdges: boolean

Specifies if edges are connectable. This overrides the connectable field in edges.

default

false

connectionHandler

connectionHandler: mxConnectionHandler

constrainChildren

constrainChildren: boolean

Specifies if a child should be constrained inside the parent bounds after a move or resize of the child.

default

true

constrainRelativeChildren

constrainRelativeChildren: boolean

Specifies if child cells with relative geometries should be constrained inside the parent bounds, if constrainChildren is true, and/or the maximumGraphBounds.

default

false

container

container: HTMLElement

containsValidationErrorsResource

containsValidationErrorsResource: string

Specifies the resource key for the warning message to be displayed when a collapsed cell contains validation errors. If the resource for this key does not exist then the value is used as the warning message.

default

'containsValidationErrors'

createSelectionCellsHandler

createSelectionCellsHandler: mxSelectionCellsHandler

Creates and returns a new mxTooltipHandler to be used in this graph.

defaultLoopStyle

defaultLoopStyle: any

mxEdgeStyle to be used for loops. This is a fallback for loops if the mxConstants.STYLE_LOOP is undefined.

default

mxEdgeStyle.Loop

defaultOverlap

defaultOverlap: number

Value returned by getOverlap if isAllowOverlapParent returns true for the given cell. getOverlap is used in constrainChild if isConstrainChild returns true. The value specifies the portion of the child which is allowed to overlap the parent.

defaultParent

defaultParent: mxCell

Specifies the default parent to be used to insert new cells. This is used in getDefaultParent.

default

null

dialect

Dialect to be used for drawing the graph. Possible values are all constants in mxConstants with a DIALECT-prefix.

disconnectOnMove

disconnectOnMove: boolean

Specifies if edges should be disconnected from their terminals when they are moved.

default

true

doubleTapEnabled

doubleTapEnabled: boolean

Specifies if double taps on touch-based devices should be handled as a double click.

default

true

doubleTapTimeout

doubleTapTimeout: number

Specifies the timeout in milliseconds for double taps and non-native double clicks.

default

500

doubleTapTolerance

doubleTapTolerance: number

Specifies the tolerance in pixels for double taps and double clicks in quirks mode.

default

25

dropEnabled

dropEnabled: boolean

Specifies the return value for isDropEnabled.

default

false

edgeLabelsMovable

edgeLabelsMovable: boolean

Specifies the return value for edges in isLabelMovable.

default

true

enabled

enabled: boolean

Specifies the return value for isEnabled.

default

true

enterStopsCellEditing

enterStopsCellEditing: boolean

If true, pressing the enter key without pressing control or shift will stop editing and accept the new value. This is used in mxCellEditor to stop cell editing. Note: You can always use F2 and escape to stop editing.

default

false

escapeEnabled

escapeEnabled: boolean

Specifies if mxKeyHandler should invoke escape when the escape key is pressed.

default

true

eventListeners

eventListeners: any[]

Variable: eventListeners

Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

eventSource

eventSource: any

Variable: eventSource

Optional source for events. Default is null.

eventsEnabled

eventsEnabled: boolean

Variable: eventsEnabled

Specifies if events can be fired. Default is true.

expandedImage

expandedImage: mxImage

Specifies the mxImage to indicate a expanded state. Default value is mxClient.imageBasePath + '/expanded.gif'

exportEnabled

exportEnabled: boolean

Specifies the return value for canExportCell.

default

true

extendParents

extendParents: boolean

Specifies if a parent should contain the child bounds after a resize of the child. This has precedence over constrainChildren.

default

true

extendParentsOnAdd

extendParentsOnAdd: boolean

Specifies if parents should be extended according to the extendParents switch if cells are added.

default

true

extendParentsOnMove

extendParentsOnMove: boolean

Specifies if parents should be extended according to the extendParents switch if cells are added.

default

false (for backwards compatibility)

foldingEnabled

foldingEnabled: boolean

Specifies if folding (collapse and expand via an image icon in the graph should be enabled).

default

true

graphHandler

graphHandler: mxGraphHandler

gridEnabled

gridEnabled: boolean

Specifies if the grid is enabled. This is used in snap.

default

true

gridSize

gridSize: number

Specifies the grid size.

default

10

htmlLabels

htmlLabels: boolean

Specifies the return value for isHtmlLabel.

default

false

ignoreScrollbars

ignoreScrollbars: boolean

Specifies if the graph should automatically scroll regardless of the scrollbars. This will scroll the container using positive values for scroll positions (ie usually only rightwards and downwards). To avoid possible conflicts with panning, set translateToScrollPosition to true.

imageBundles

imageBundles: mxImageBundle[]

Holds the list of image bundles.

importEnabled

importEnabled: boolean

Specifies the return value for canImportCell.

default

true

initialTouchX

initialTouchX: number

Holds the x-coordinate of the initial touch event for tap and hold.

initialTouchY

initialTouchY: number

Holds the y-coordinate of the initial touch event for tap and hold.

invokesStopCellEditing

invokesStopCellEditing: boolean

If true, when editing is to be stopped by way of selection changing, data in diagram changing or other means stopCellEditing is invoked, and changes are saved. This is implemented in a focus handler in mxCellEditor.

default

true

isMouseDown

isMouseDown: boolean

Holds the state of the mouse button.

keepEdgesInBackground

keepEdgesInBackground: boolean

Specifies if edges should appear in the background regardless of their order in the model. If keepEdgesInForeground and keepEdgesInBackground are both true then the normal order is applied.

default

false

keepEdgesInForeground

keepEdgesInForeground: boolean

Specifies if edges should appear in the foreground regardless of their order in the model. If keepEdgesInForeground and keepEdgesInBackground are both true then the normal order is applied.

default

false

keepSelectionVisibleOnZoom

keepSelectionVisibleOnZoom: boolean

Specifies if the viewport should automatically contain the selection cells after a zoom operation.

default

false

labelsVisible

labelsVisible: boolean

Specifies if labels should be visible. This is used in getLabel. Default is true.

lastTouchTime

lastTouchTime: number

Holds the time of the last touch event for double click detection.

lastTouchY

lastTouchY: number

Holds the x-coordinate of the last touch event for double tap detection.

maxFitScale

maxFitScale: number

Specifies the maximum scale to be applied in fit. Set this to null to allow any value.

default

8

maximumContainerSize

maximumContainerSize: mxRectangle

mxRectangle that specifies the maximum size of the container if resizeContainer is true.

maximumGraphBounds

maximumGraphBounds: mxRectangle

mxRectangle that specifies the area in which all cells in the diagram should be placed. Uses in getMaximumGraphBounds. Use a width or height of 0 if you only want to give a upper, left corner.

minFitScale

minFitScale: number

Specifies the minimum scale to be applied in fit. Set this to null to allow any value.

default

0.1

minPageBreakDist

minPageBreakDist: number

Specifies the minimum distance in pixels for page breaks to be visible.

default

20

minimumContainerSize

minimumContainerSize: mxRectangle

mxRectangle that specifies the minimum size of the container if resizeContainer is true.

minimumGraphSize

minimumGraphSize: mxRectangle

mxRectangle that specifies the minimum size of the graph. This is ignored if the graph container has no scrollbars.

default

null

model

Holds the mxGraphModel that contains the cells to be displayed.

mouseListeners

mouseListeners: any[]

Holds the mouse event listeners. See fireMouseEvent.

multigraph

multigraph: boolean

Specifies if multiple edges in the same direction between the same pair of vertices are allowed.

default

true

multiplicities

multiplicities: mxMultiplicity[]

An array of mxMultiplicity describing the allowed connections in a graph.

nativeDblClickEnabled

nativeDblClickEnabled: boolean

Specifies if native double click events should be detected.

default

true

pageBreakColor

pageBreakColor: string

Specifies the color for page breaks.

default

gray

pageBreakDashed

pageBreakDashed: boolean

Specifies the page breaks should be dashed.

default

true

pageBreaksVisible

pageBreaksVisible: boolean

Specifies if a dashed line should be drawn between multiple pages. If you change this value while a graph is being displayed then you should call sizeDidChange to force an update of the display.

default

false

pageFormat

pageFormat: mxRectangle

Specifies the page format for the background page. This is used as the default in mxPrintPreview and for painting the background page if pageVisible is true and the page breaks if pageBreaksVisible is true.

default

mxConstants.PAGE_FORMAT_A4_PORTRAIT

pageScale

pageScale: number

Specifies the scale of the background page. Not yet implemented.

default

1.5

pageVisible

pageVisible: boolean

Specifies if the background page should be visible. Not yet implemented.

default

false

panDx

panDx: number

Current horizontal panning value.

default

0

panDy

panDy: number

Current vertical panning value.

default

0

panningHandler

panningHandler: mxPanningHandler

popupMenuHandler

popupMenuHandler: mxPopupMenuHandler

portsEnabled

portsEnabled: boolean

Specifies if ports are enabled. This is used in cellConnected to update the respective style.

default

true

preferPageSize

preferPageSize: boolean

Specifies if the graph size should be rounded to the next page number in sizeDidChange. This is only used if the graph container has scrollbars.

default

false

recursiveResize

recursiveResize: boolean

Specifies the return value for isRecursiveResize.

default

false (for backwards compatibility)

renderHint

renderHint: any

RenderHint as it was passed to the constructor.

resetEdgesOnConnect

resetEdgesOnConnect: boolean

Specifies if edge control points should be reset after the the edge has been reconnected.

default

true

resetEdgesOnMove

resetEdgesOnMove: boolean

Specifies if edge control points should be reset after the move of a connected cell.

default

false

resetEdgesOnResize

resetEdgesOnResize: boolean

Specifies if edge control points should be reset after the resize of a connected cell.

default

false

resetViewOnRootChange

resetViewOnRootChange: boolean

Specifies if the scale and translate should be reset if the root changes in the model.

default

true

resizeContainer

resizeContainer: boolean

Specifies if the container should be resized to the graph size when the graph size has changed.

default

false

selectionCellsHandler

selectionCellsHandler: mxSelectionCellsHandler

selectionModel

selectionModel: mxGraphSelectionModel

Holds the mxGraphSelectionModel that models the current selection.

splitEnabled

splitEnabled: boolean

Specifies if dropping onto edges should be enabled. This is ignored if dropEnabled is false. If enabled, it will call splitEdge to carry out the drop operation.

default

true

stylesheet

stylesheet: mxStylesheet

Holds the mxStylesheet that defines the appearance of the cells.

Use the following code to read a stylesheet into an existing graph.

example
var req = mxUtils.load('stylesheet.xml');
var root = req.getDocumentElement();
var dec = new mxCodec(root.ownerDocument);
dec.decode(root, graph.stylesheet);

swimlaneIndicatorColorAttribute

swimlaneIndicatorColorAttribute: string

The attribute used to find the color for the indicator if the indicator color is set to 'swimlane'.

default

mxConstants.STYLE_FILLCOLOR

swimlaneNesting

swimlaneNesting: boolean

Specifies if nesting of swimlanes is allowed.

default

true

swimlaneSelectionEnabled

swimlaneSelectionEnabled: boolean

Specifies if swimlanes should be selectable via the content if the mouse is released.

default

true

tapAndHoldDelay

tapAndHoldDelay: number

Specifies the time in milliseconds for a tap and hold.

default

500

tapAndHoldEnabled

tapAndHoldEnabled: boolean

Specifies if tap and hold should be used for starting connections on touch-based devices.

default

true

tapAndHoldInProgress

tapAndHoldInProgress: boolean

True if the timer for tap and hold events is running.

tapAndHoldValid

tapAndHoldValid: boolean

True as long as the timer is running and the touch events stay within the given {@link tapAndHoldTolerance}.

timerAutoScroll

timerAutoScroll: boolean

Specifies if autoscrolling should be carried out via mxPanningManager even if the container has scrollbars. This disables scrollPointToVisible and uses mxPanningManager instead. If this is true then autoExtend is disabled. It should only be used with a scroll buffer or when scollbars are visible and scrollable in all directions.

default

false

tolerance

tolerance: number

Tolerance in pixels for a move to be handled as a single click.

default

4

tooltipHandler

tooltipHandler: mxTooltipHandler

translateToScrollPosition

translateToScrollPosition: boolean

Specifies if the graph should automatically convert the current scroll position to a translate in the graph view when a mouseUp event is received. This can be used to avoid conflicts when using autoScroll and ignoreScrollbars with no scrollbars in the container.

useScrollbarsForPanning

useScrollbarsForPanning: boolean

Specifies if scrollbars should be used for panning in panGraph if any scrollbars are available. If scrollbars are enabled in CSS, but no scrollbars appear because the graph is smaller than the container size, then no panning occurs if this is true.

default

true

vertexLabelsMovable

vertexLabelsMovable: boolean

Specifies the return value for vertices in isLabelMovable.

default

false

view

Holds the mxGraphView that caches the mxCellStates for the cells.

warningImage

warningImage: mxImage

Specifies the mxImage for the image to be used to display a warning overlay. See setCellWarning. Default value is mxClient.imageBasePath + '/warning'. The extension for the image depends on the platform. It is '.png' on the Mac and '.gif' on all other platforms.

zoomFactor

zoomFactor: number

Specifies the factor used for zoomIn and zoomOut.

default

1.2 (120%)

Methods

addAllEdges

  • Returns an array with the given cells and all edges that are connected to a cell or one of its descendants.

    Parameters

    Returns mxCell[]

addCell

  • Adds the cell to the parent and connects it to the given source and target terminals. This is a shortcut method. Returns the cell that was added.

    Parameters

    • cell: mxCell

      mxCell to be inserted into the given parent.

    • Optional parent: mxCell

      mxCell that represents the new parent. If no parent is given then the default parent is used.

    • Optional index: number

      Optional index to insert the cells at. Default is 'to append'.

    • Optional source: mxCell

      Optional mxCell that represents the source terminal.

    • Optional target: mxCell

      Optional mxCell that represents the target terminal.

    Returns mxCell

addCellOverlay

addCells

  • Adds the cells to the parent at the given index, connecting each cell to the optional source and target terminal. The change is carried out using cellsAdded. This method fires mxEvent.ADD_CELLS while the transaction is in progress. Returns the cells that were added.

    Parameters

    • cells: mxCell[]

      Array of mxCell to be inserted.

    • Optional parent: mxCell

      mxCell that represents the new parent. If no parent is given then the default parent is used.

    • Optional index: number

      Optional index to insert the cells at. Default is 'to append'.

    • Optional source: mxCell

      Optional source mxCell for all inserted cells.

    • Optional target: mxCell

      Optional target mxCell for all inserted cells.

    • Optional absolute: boolean

      Optional boolean indicating of cells should be kept at their absolute position. Default is false.

    Returns mxCell[]

addEdge

  • Adds the edge to the parent and connects it to the given source and target terminals. This is a shortcut method. Returns the edge that was added.

    Parameters

    • edge: mxCell

      mxCell to be inserted into the given parent.

    • Optional parent: mxCell

      mxCell that represents the new parent. If no parent is given then the default parent is used.

    • Optional source: mxCell

      Optional mxCell that represents the source terminal.

    • Optional target: mxCell

      Optional mxCell that represents the target terminal.

    • Optional index: number

      Optional index to insert the cells at. Default is 'to append'.

    Returns mxCell

addImageBundle

addListener

  • addListener(name: string, funct: (...args: any[]) => any): void
  • Function: addListener

    Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

    The parameters of the listener are the sender and an .

    Parameters

    • name: string
    • funct: (...args: any[]) => any
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns void

addMouseListener

  • addMouseListener(listener: {}): void

addSelectionCell

  • addSelectionCell(cell: mxCell): void

addSelectionCells

  • addSelectionCells(cells: mxCell[]): void

alignCells

  • alignCells(align: string, cells: mxCell[], param?: any): mxCell[]
  • Aligns the given cells vertically or horizontally according to the given alignment using the optional parameter as the coordinate.

    Parameters

    • align: string

      Specifies the alignment. Possible values are all constants in mxConstants with an ALIGN prefix.

    • cells: mxCell[]

      Array of mxCell to be aligned.

    • Optional param: any

      Optional coordinate for the alignment.

    Returns mxCell[]

autoSizeCell

  • autoSizeCell(cell: mxCell, recurse?: boolean): void
  • Resizes the specified cell to just fit around the its label and/or children

    Parameters

    • cell: mxCell

      mxCell to be resized.

    • Optional recurse: boolean

      Optional boolean which specifies if all descendants should be autosized. Default is true.

    Returns void

canExportCell

  • canExportCell(cell: mxCell): boolean
  • Returns true if the given cell may be exported to the clipboard. This implementation returns exportEnabled for all cells.

    Parameters

    • cell: mxCell

      mxCell that represents the cell to be exported.

    Returns boolean

canImportCell

  • canImportCell(cell: mxCell): boolean
  • Returns true if the given cell may be imported from the clipboard. This implementation returns importEnabled for all cells.

    Parameters

    • cell: mxCell

      mxCell that represents the cell to be imported.

    Returns boolean

cellConnected

cellLabelChanged

  • cellLabelChanged(cell: mxCell, value: any, autoSize?: boolean): void
  • Sets the new label for a cell. If autoSize is true then cellSizeUpdated will be called.

    In the following example, the function is extended to map changes to attributes in an XML node, as shown in convertValueToString. Alternatively, the handling of this can be implemented as shown in mxGraphModel.valueForCellChanged without the need to clone the user object.

    var graphCellLabelChanged = graph.cellLabelChanged;
    graph.cellLabelChanged = function(cell, newValue, autoSize)
    {
        // Cloned for correct undo/redo
        var elt = cell.value.cloneNode(true);
     elt.setAttribute('label', newValue);
    
     newValue = elt;
     graphCellLabelChanged.apply(this, arguments);
    };
    

    Parameters

    • cell: mxCell

      mxCell whose label should be changed.

    • value: any

      New label to be assigned.

    • Optional autoSize: boolean

      Boolean that specifies if cellSizeUpdated should be called.

    Returns void

cellResized

  • Resizes the parents recursively so that they contain the complete area of the resized child cell.

    Parameters

    • cell: mxCell

      mxCell whose bounds should be changed.

    • bounds: mxRectangle

      {@link mxRectangles} that represent the new bounds.

    • Optional ignoreRelative: boolean

      Boolean that indicates if relative cells should be ignored.

    • Optional recurse: boolean

      Optional boolean that specifies if the children should be resized.

    Returns mxGeometry

cellSizeUpdated

  • cellSizeUpdated(cell: mxCell, ignoreChildren: boolean): void

cellsAdded

  • cellsAdded(cells: mxCell[], parent: mxCell, index: number, source?: mxCell, target?: mxCell, absolute?: boolean, constrain?: boolean, extend?: boolean): void
  • Adds the specified cells to the given parent. This method fires mxEvent.CELLS_ADDED while the transaction is in progress.

    Parameters

    • cells: mxCell[]
    • parent: mxCell
    • index: number
    • Optional source: mxCell
    • Optional target: mxCell
    • Optional absolute: boolean
    • Optional constrain: boolean
    • Optional extend: boolean

    Returns void

cellsFolded

  • cellsFolded(cells: mxCell[], collapse: boolean, recurse: boolean, checkFoldable?: boolean): void
  • Sets the collapsed state of the specified cells. This method fires mxEvent.CELLS_FOLDED while the transaction is in progress. Returns the cells whose collapsed state was changed.

    Parameters

    • cells: mxCell[]

      Array of mxCell whose collapsed state should be set.

    • collapse: boolean

      Boolean indicating the collapsed state to be assigned.

    • recurse: boolean

      Boolean indicating if the collapsed state of all descendants should be set.

    • Optional checkFoldable: boolean

      Optional boolean indicating of isCellFoldable should be checked. Default is false.

    Returns void

cellsMoved

  • cellsMoved(cells: mxCell[], dx: number, dy: number, disconnect?: boolean, constrain?: boolean, extend?: boolean): void
  • Moves the specified cells by the given vector, disconnecting the cells using disconnectGraph is disconnect is true. This method fires mxEvent.CELLS_MOVED while the transaction is in progress.

    Parameters

    • cells: mxCell[]
    • dx: number
    • dy: number
    • Optional disconnect: boolean
    • Optional constrain: boolean
    • Optional extend: boolean

    Returns void

cellsOrdered

  • cellsOrdered(cells: mxCell[], back?: boolean): void
  • Moves the given cells to the front or back. This method fires mxEvent.CELLS_ORDERED while the transaction is in progress.

    Parameters

    • cells: mxCell[]

      Array of mxCell whose order should be changed.

    • Optional back: boolean

      Boolean that specifies if the cells should be moved to back.

    Returns void

cellsRemoved

  • cellsRemoved(cells: mxCell[]): void

cellsResized

  • Sets the bounds of the given cells and fires a mxEvent.CELLS_RESIZED event. If extendParents is true, then the parent is extended if a child size is changed so that it overlaps with the parent.

    The following example shows how to control group resizes to make sure that all child cells stay within the group.

    graph.addListener(mxEvent.CELLS_RESIZED, function(sender, evt)
    {
      var cells = evt.getProperty('cells');
    
      if (cells != null)
      {
        for (var i = 0; i < cells.length; i++)
        {
          if (graph.getModel().getChildCount(cells[i]) > 0)
          {
            var geo = graph.getCellGeometry(cells[i]);
    
            if (geo != null)
            {
              var children = graph.getChildCells(cells[i], true, true);
              var bounds = graph.getBoundingBoxFromGeometry(children, true);
    
              geo = geo.clone();
              geo.width = Math.max(geo.width, bounds.width);
              geo.height = Math.max(geo.height, bounds.height);
    
              graph.getModel().setGeometry(cells[i], geo);
            }
          }
        }
      }
    });
    

    Parameters

    • cells: mxCell[]

      Array of mxCell whose bounds should be changed.

    • bounds: mxRectangle[]

      Array of {@link mxRectangles} that represent the new bounds.

    • Optional recurse: boolean

      Optional boolean that specifies if the children should be resized.

    Returns mxGeometry[]

cellsToggled

  • cellsToggled(cells: mxCell[], show: boolean): void
  • Sets the visible state of the specified cells.

    Parameters

    • cells: mxCell[]

      Array of mxCell whose visible state should be changed.

    • show: boolean

      Boolean that specifies the visible state to be assigned.

    Returns void

center

  • center(horizontal?: boolean, vertical?: boolean, cx?: number, cy?: number): void
  • Centers the graph in the container.

    Parameters

    • Optional horizontal: boolean

      Optional boolean that specifies if the graph should be centered horizontally. Default is true.

    • Optional vertical: boolean

      Optional boolean that specifies if the graph should be centered vertically. Default is true.

    • Optional cx: number

      Optional float that specifies the horizontal center. Default is 0.5.

    • Optional cy: number

      Optional float that specifies the vertical center. Default is 0.5.

    Returns void

clearCellOverlays

  • clearCellOverlays(cell: mxCell): void
  • Removes all {@link mxCellOverlays} in the graph for the given cell and all its descendants. If no cell is specified then all overlays are removed from the graph. This implementation uses removeCellOverlays to remove the overlays from the individual cells.

    Parameters

    • cell: mxCell

      Optional mxCell that represents the root of the subtree to remove the overlays from. Default is the root in the model.

    Returns void

clearSelection

  • clearSelection(): void

click

  • Processes a singleclick on an optional cell and fires a click event. The click event is fired initially. If the graph is enabled and the event has not been consumed, then the cell is selected using selectCellForEvent or the selection is cleared using clearSelection. The events consumed state is set to true if the corresponding mxMouseEvent has been consumed.

    To handle a click event, use the following code.

    graph.addListener(mxEvent.CLICK, function(sender, evt)
    {
      var e = evt.getProperty('event'); // mouse event
      var cell = evt.getProperty('cell'); // cell may be null
    
      if (cell != null)
      {
        // Do something useful with cell and consume the event
        evt.consume();
      }
    });
    

    Parameters

    Returns void

cloneCell

  • cloneCell(cell: mxCell, allowInvalidEdges?: boolean, mapping?: any, keepPosition?: boolean): mxCell[]
  • Returns the clone for the given cell. Uses cloneCells.

    Parameters

    • cell: mxCell

      mxCell to be cloned.

    • Optional allowInvalidEdges: boolean

      Optional boolean that specifies if invalid edges should be cloned. Default is true.

    • Optional mapping: any

      Optional mapping for existing clones.

    • Optional keepPosition: boolean

      Optional boolean indicating if the position of the cells should be updated to reflect the lost parent cell. Default is false.

    Returns mxCell[]

cloneCells

  • cloneCells(cells: mxCell[], allowInvalidEdges?: boolean, mapping?: any, keepPosition?: boolean): mxCell[]
  • Returns the clones for the given cells. The clones are created recursively using mxGraphModel.cloneCells. If the terminal of an edge is not in the given array, then the respective end is assigned a terminal point and the terminal is removed.

    Parameters

    • cells: mxCell[]

      Array of mxCell to be cloned.

    • Optional allowInvalidEdges: boolean

      Optional boolean that specifies if invalid edges should be cloned. Default is true.

    • Optional mapping: any

      Optional mapping for existing clones.

    • Optional keepPosition: boolean

      Optional boolean indicating if the position of the cells should be updated to reflect the lost parent cell. Default is false.

    Returns mxCell[]

connectCell

constrainChild

  • constrainChild(cell: mxCell, sizeFirst?: boolean): void
  • Keeps the given cell inside the bounds returned by getCellContainmentArea for its parent, according to the rules defined by getOverlap and isConstrainChild. This modifies the cell's geometry in-place and does not clone it.

    Parameters

    • cell: mxCell

      mxCell which should be constrained.

    • Optional sizeFirst: boolean

      Specifies if the size should be changed first. Default is true.

    Returns void

constrainChildCells

  • constrainChildCells(cell: mxCell): void

consumeMouseEvent

convertValueToString

  • convertValueToString(cell: mxCell): string
  • Returns the textual representation for the given cell. This implementation returns the nodename or string-representation of the user object.

    The following returns the label attribute from the cells user object if it is an XML node.

    example
    graph.convertValueToString = function(cell)
    {
        return cell.getAttribute('label');
    }
    

    See also: cellLabelChanged.

    Parameters

    • cell: mxCell

      mxCell whose textual representation should be returned.

    Returns string

createCellEditor

createCellRenderer

createConnectionHandler

createEdge

  • Hook method that creates the new edge for insertEdge. This implementation does not set the source and target of the edge, these are set when the edge is added to the model.

    Parameters

    • parent: mxCell
    • id: null | string
    • value: any
    • source: mxCell
    • target: mxCell
    • Optional style: string

    Returns mxCell

createEdgeHandler

createEdgeSegmentHandler

createElbowEdgeHandler

createGraphHandler

createGraphView

createGroupCell

  • Hook for creating the group cell to hold the given array of mxCell if no group cell was given to the {@link group} function.

    The following code can be used to set the style of new group cells.

    var graphCreateGroupCell = graph.createGroupCell;
    graph.createGroupCell = function(cells)
    {
      var group = graphCreateGroupCell.apply(this, arguments);
      group.setStyle('group');
    
      return group;
    };
    

    Parameters

    Returns mxCell

createHandler

createHandlers

  • createHandlers(): void
  • Creates the tooltip-, panning-, connection- and graph-handler (in this order). This is called in the constructor before init is called.

    Returns void

createPanningHandler

createPanningManager

createPopupMenuHandler

createSelectionModel

createStylesheet

createTooltipHandler

createVertex

  • createVertex(parent: mxCell, id: null | string, value: any, x: number, y: number, width: number, height: number, style?: string, relative?: boolean): mxCell
  • Hook method that creates the new vertex for insertVertex.

    Parameters

    • parent: mxCell
    • id: null | string
    • value: any
    • x: number
    • y: number
    • width: number
    • height: number
    • Optional style: string
    • Optional relative: boolean

    Returns mxCell

createVertexHandler

dblClick

  • dblClick(evt: MouseEvent, cell?: mxCell): void
  • Processes a doubleclick on an optional cell and fires a {@link dblclick} event. The event is fired initially. If the graph is enabled and the event has not been consumed, then {@link edit} is called with the given cell. The event is ignored if no cell was specified.

    Example for overriding this method.

    graph.dblClick = function(evt, cell)
    {
      var mxe = new mxEventObject(mxEvent.DOUBLE_CLICK, 'event', evt, 'cell', cell);
      this.fireEvent(mxe);
    
      if (this.isEnabled() && !mxEvent.isConsumed(evt) && !mxe.isConsumed())
      {
           mxUtils.alert('Hello, World!');
        mxe.consume();
      }
    }
    

    Example listener for this event.

    graph.addListener(mxEvent.DOUBLE_CLICK, function(sender, evt)
    {
      var cell = evt.getProperty('cell');
      // do something with the cell and consume the
      // event to prevent in-place editing from start
    });
    

    Parameters

    • evt: MouseEvent

      Mouseevent that represents the doubleclick.

    • Optional cell: mxCell

      Optional mxCell under the mousepointer.

    Returns void

destroy

  • destroy(): void

disconnectGraph

  • disconnectGraph(cells: mxCell[]): void
  • Disconnects the given edges from the terminals which are not in the given array.

    Parameters

    Returns void

doResizeContainer

  • doResizeContainer(width: number, height: number): void
  • Resizes the container for the given graph width and height.

    Parameters

    • width: number
    • height: number

    Returns void

enterGroup

  • enterGroup(cell: mxCell): void
  • Uses the given cell as the root of the displayed cell hierarchy. If no cell is specified then the selection cell is used. The cell is only used if isValidRoot returns true.

    Parameters

    • cell: mxCell

      Optional mxCell to be used as the new root. Default is the selection cell.

    Returns void

escape

  • escape(evt?: MouseEvent): void
  • Processes an escape keystroke.

    Parameters

    • Optional evt: MouseEvent

      Mouseevent that represents the keystroke.

    Returns void

exitGroup

  • exitGroup(): void
  • Changes the current root to the next valid root in the displayed cell hierarchy.

    Returns void

extendParent

  • extendParent(cell: mxCell): void
  • Resizes the parents recursively so that they contain the complete area of the resized child cell.

    Parameters

    Returns void

findTreeRoots

  • findTreeRoots(parent: mxCell, isolate?: boolean, invert?: boolean): mxCell[]
  • Returns all children in the given parent which do not have incoming edges. If the result is empty then the with the greatest difference between incoming and outgoing edges is returned.

    Parameters

    • parent: mxCell

      mxCell whose children should be checked.

    • Optional isolate: boolean

      Optional boolean that specifies if edges should be ignored if the opposite end is not a child of the given parent cell. Default is false.

    • Optional invert: boolean

      Optional boolean that specifies if outgoing or incoming edges should be counted for a tree root. If false then outgoing edges will be counted. Default is false.

    Returns mxCell[]

fireEvent

  • Function: fireEvent

    Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see <mxUtils.bind>).

    Example:

    (code) fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN)) (end)

    Parameters:

    evt - that represents the event. sender - Optional sender to be passed to the listener. Default value is the return value of .

    Parameters

    Returns void

fireGestureEvent

  • fireGestureEvent(evt: any, cell?: mxCell): void
  • Dispatches a mxEvent.GESTURE event. The following example will resize the cell under the mouse based on the scale property of the native touch event.

    graph.addListener(mxEvent.GESTURE, function(sender, eo)
    {
      var evt = eo.getProperty('event');
      var state = graph.view.getState(eo.getProperty('cell'));
    
      if (graph.isEnabled() && graph.isCellResizable(state.cell) && Math.abs(1 - evt.scale) > 0.2)
      {
        var scale = graph.view.scale;
        var tr = graph.view.translate;
    
        var w = state.width * evt.scale;
        var h = state.height * evt.scale;
        var x = state.x - (w - state.width) / 2;
        var y = state.y - (h - state.height) / 2;
    
        var bounds = new mxRectangle(graph.snap(x / scale) - tr.x,
                graph.snap(y / scale) - tr.y, graph.snap(w / scale), graph.snap(h / scale));
        graph.resizeCell(state.cell, bounds);
        eo.consume();
      }
    });
    

    Parameters

    • evt: any

      Gestureend event that represents the gesture.

    • Optional cell: mxCell

      Optional mxCell associated with the gesture.

    Returns void

fireMouseEvent

fit

  • fit(border: number, keepOrigin?: boolean, margin?: number, enabled?: boolean, ignoreWidth?: boolean, ignoreHeight?: boolean, maxHeight?: number): number
  • Scales the graph such that the complete diagram fits into container and returns the current scale in the view. To fit an initial graph prior to rendering, set mxGraphView.rendering to false prior to changing the model and execute the following after changing the model.

    graph.fit();
    graph.view.rendering = true;
    graph.refresh();
    

    To fit and center the graph, the following code can be used.

    var margin = 2;
    var max = 3;
    
    var bounds = graph.getGraphBounds();
    var cw = graph.container.clientWidth - margin;
    var ch = graph.container.clientHeight - margin;
    var w = bounds.width / graph.view.scale;
    var h = bounds.height / graph.view.scale;
    var s = Math.min(max, Math.min(cw / w, ch / h));
    
    graph.view.scaleAndTranslate(s,
      (margin + cw - w * s) / (2 * s) - bounds.x / graph.view.scale,
      (margin + ch - h * s) / (2 * s) - bounds.y / graph.view.scale);
    

    Parameters

    • border: number

      Optional number that specifies the border. Default is border.

    • Optional keepOrigin: boolean

      Optional boolean that specifies if the translate should be changed. Default is false.

    • Optional margin: number

      Optional margin in pixels. Default is 0.

    • Optional enabled: boolean

      Optional boolean that specifies if the scale should be set or just returned. Default is true.

    • Optional ignoreWidth: boolean

      Optional boolean that specifies if the width should be ignored. Default is false.

    • Optional ignoreHeight: boolean

      Optional boolean that specifies if the height should be ignored. Default is false.

    • Optional maxHeight: number

      Optional maximum height.

    Returns number

flipEdge

  • Toggles the style of the given edge between null (or empty) and alternateEdgeStyle. This method fires mxEvent.FLIP_EDGE while the transaction is in progress. Returns the edge that was flipped.

    Here is an example that overrides this implementation to invert the value of mxConstants.STYLE_ELBOW without removing any existing styles.

    graph.flipEdge = function(edge)
    {
      if (edge != null)
      {
        var style = this.getCurrentCellStyle(edge);
        var elbow = mxUtils.getValue(style, mxConstants.STYLE_ELBOW,
            mxConstants.ELBOW_HORIZONTAL);
        var value = (elbow == mxConstants.ELBOW_HORIZONTAL) ?
            mxConstants.ELBOW_VERTICAL : mxConstants.ELBOW_HORIZONTAL;
        this.setCellStyles(mxConstants.STYLE_ELBOW, value, [edge]);
      }
    };
    

    Parameters

    Returns mxCell

foldCells

  • foldCells(collapse: boolean, recurse: boolean, cells: mxCell[], checkFoldable?: boolean, evt?: Event): mxCell[]
  • Sets the collapsed state of the specified cells and all descendants if recurse is true. The change is carried out using cellsFolded. This method fires mxEvent.FOLD_CELLS while the transaction is in progress. Returns the cells whose collapsed state was changed.

    Parameters

    • collapse: boolean

      Boolean indicating the collapsed state to be assigned.

    • recurse: boolean

      Optional boolean indicating if the collapsed state of all descendants should be set. Default is false.

    • cells: mxCell[]

      Array of mxCell whose collapsed state should be set. If null is specified then the foldable selection cells are used.

    • Optional checkFoldable: boolean

      Optional boolean indicating of isCellFoldable should be checked. Default is false.

    • Optional evt: Event

      Optional native event that triggered the invocation.

    Returns mxCell[]

getActualStartSize

  • Returns the actual start size of the given swimlane taking into account direction and horizontal and vertial flip styles. The start size is returned as an mxRectangle where top, left, bottom, right start sizes are returned as x, y, height and width, respectively.

    Parameters

    • swimlane: mxCell

      mxCell whose start size should be returned.

    • Optional ignoreState: boolean

      Optional boolean that specifies if cell state should be ignored.

    Returns mxRectangle

getAllConnectionConstraints

  • Returns an array of all {@link mxConnectionConstraints} for the given terminal. If the shape of the given terminal is a {@link mxStencilShape} then the constraints of the corresponding mxStencil are returned.

    Parameters

    • terminal: mxCellState

      mxCellState that represents the terminal.

    • Optional source: boolean

      Boolean that specifies if the terminal is the source or target.

    Returns mxConnectionConstraint[]

getAllEdges

getBackgroundImage

getBorder

  • getBorder(): number

getBorderSizes

  • Returns the size of the border and padding on all four sides of the container. The left, top, right and bottom borders are stored in the x, y, width and height of the returned mxRectangle, respectively.

    Returns mxRectangle

getBoundingBox

getBoundingBoxFromGeometry

  • Returns the bounding box for the geometries of the vertices in the given array of cells. This can be used to find the graph bounds during a layout operation (ie. before the last endUpdate) as follows:

    var cells = graph.getChildCells(graph.getDefaultParent(), true, true);
    var bounds = graph.getBoundingBoxFromGeometry(cells, true);
    

    This can then be used to move cells to the origin:

    if (bounds.x < 0 || bounds.y < 0)
    {
      graph.moveCells(cells, -Math.min(bounds.x, 0), -Math.min(bounds.y, 0))
    }
    

    Or to translate the graph view:

    if (bounds.x < 0 || bounds.y < 0)
    {
      graph.view.setTranslate(-Math.min(bounds.x, 0), -Math.min(bounds.y, 0));
    }
    

    Parameters

    • cells: mxCell[]

      Array of mxCell whose bounds should be returned.

    • Optional includeEdges: boolean

      Specifies if edge bounds should be included by computing the bounding box for all points in geometry. Default is false.

    Returns mxRectangle

getBoundsForGroup

getCellAt

  • getCellAt(x: number, y: number, parent?: mxCell, vertices?: boolean, edges?: boolean, ignoreFn?: Function): mxCell
  • Returns the bottom-most cell that intersects the given point (x, y) in the cell hierarchy starting at the given parent. This will also return swimlanes if the given location intersects the content area of the swimlane. If this is not desired, then the hitsSwimlaneContent may be used if the returned cell is a swimlane to determine if the location is inside the content area or on the actual title of the swimlane.

    Parameters

    • x: number

      X-coordinate of the location to be checked.

    • y: number

      Y-coordinate of the location to be checked.

    • Optional parent: mxCell

      mxCell that should be used as the root of the recursion. Default is current root of the view or the root of the model.

    • Optional vertices: boolean

      Optional boolean indicating if vertices should be returned. Default is true.

    • Optional edges: boolean

      Optional boolean indicating if edges should be returned. Default is true.

    • Optional ignoreFn: Function

      Optional function that returns true if cell should be ignored. The function is passed the cell state and the x and y parameter.

    Returns mxCell

getCellBounds

  • getCellBounds(cell: mxCell, includeEdges?: boolean, includeDescendants?: boolean): mxRectangle
  • Returns the scaled, translated bounds for the given cell. See mxGraphView.getBounds for arrays.

    Parameters

    • cell: mxCell

      mxCell whose bounds should be returned.

    • Optional includeEdges: boolean

      Optional boolean that specifies if the bounds of the connected edges should be included. Default is false.

    • Optional includeDescendants: boolean

      Optional boolean that specifies if the bounds of all descendants should be included. Default is false.

    Returns mxRectangle

getCellContainmentArea

getCellGeometry

getCellOverlays

getCellStyle

  • Returns an array of key, value pairs representing the cell style for the given cell. If no string is defined in the model that specifies the style, then the default style for the cell is returned or an empty object, if no style can be found. Note: You should try and get the cell state for the given cell and use the cached style in the state before using this method.

    Parameters

    • cell: mxCell

      mxCell whose style should be returned as an array.

    Returns StyleMap

getCellValidationError

  • getCellValidationError(cell: mxCell): null | string
  • Checks all multiplicities that cannot be enforced while the graph is being modified, namely, all multiplicities that require a minimum of 1 edge.

    Parameters

    • cell: mxCell

      mxCell for which the multiplicities should be checked.

    Returns null | string

getCells

  • getCells(x: number, y: number, width: number, height: number, parent?: mxCell, result?: mxCell[]): mxCell[]
  • Returns the child vertices and edges of the given parent that are contained in the given rectangle. The result is added to the optional result array, which is returned. If no result array is specified then a new array is created and returned.

    Parameters

    • x: number

      X-coordinate of the rectangle.

    • y: number

      Y-coordinate of the rectangle.

    • width: number

      Width of the rectangle.

    • height: number

      Height of the rectangle.

    • Optional parent: mxCell

      mxCell that should be used as the root of the recursion. Default is current root of the view or the root of the model.

    • Optional result: mxCell[]

      Optional array to store the result in.

    Returns mxCell[]

getCellsBeyond

  • getCellsBeyond(x0: number, y0: number, parent?: mxCell, rightHalfpane?: boolean, bottomHalfpane?: boolean): mxCell[]
  • Returns the children of the given parent that are contained in the halfpane from the given point (x0, y0) rightwards or downwards depending on rightHalfpane and bottomHalfpane.

    Parameters

    • x0: number

      X-coordinate of the origin.

    • y0: number

      Y-coordinate of the origin.

    • Optional parent: mxCell

      Optional mxCell whose children should be checked. Default is defaultParent.

    • Optional rightHalfpane: boolean

      Boolean indicating if the cells in the right halfpane from the origin should be returned.

    • Optional bottomHalfpane: boolean

      Boolean indicating if the cells in the bottom halfpane from the origin should be returned.

    Returns mxCell[]

getCellsForGroup

getChildCells

  • getChildCells(parent: mxCell, vertices?: boolean, edges?: boolean): mxCell[]
  • Returns the visible child vertices or edges in the given parent. If vertices and edges is false, then all children are returned.

    Parameters

    • parent: mxCell

      mxCell whose children should be returned.

    • Optional vertices: boolean

      Optional boolean that specifies if child vertices should be returned. Default is false.

    • Optional edges: boolean

      Optional boolean that specifies if child edges should be returned. Default is false.

    Returns mxCell[]

getChildEdges

getChildOffsetForCell

  • getChildOffsetForCell(cell: mxCell): number

getChildVertices

getCloneableCells

getConnectionConstraint

getConnectionPoint

getConnections

  • Returns all visible edges connected to the given cell without loops.

    Parameters

    • cell: mxCell

      mxCell whose connections should be returned.

    • parent: mxCell

      Optional parent of the opposite end for a connection to be returned.

    Returns mxCell[]

getCurrentCellStyle

  • Returns the style for the given cell from the cell state, if one exists, or using getCellStyle.

    Parameters

    • cell: mxCell

      mxCell whose style should be returned as an array.

    • Optional ignoreState: boolean

      Optional boolean that specifies if the cell state should be ignored.

    Returns StyleMap

getCurrentRoot

getCursorForCell

  • getCursorForCell(cell: mxCell): string
  • Returns the cursor value to be used for the CSS of the shape for the given cell. This implementation returns null.

    Parameters

    Returns string

getCursorForMouseEvent

getDefaultParent

getDeletableCells

getDropTarget

  • Returns the given cell if it is a drop target for the given cells or the nearest ancestor that may be used as a drop target for the given cells. If the given array contains a swimlane and swimlaneNesting is false then this always returns null. If no cell is given, then the bottommost swimlane at the location of the given event is returned.

    This function should only be used if isDropEnabled returns true.

    Parameters

    • cells: mxCell[]

      Array of mxCell which are to be dropped onto the target.

    • evt: Event

      Mouseevent for the drag and drop.

    • cell: mxCell

      mxCell that is under the mousepointer.

    • Optional clone: boolean

      Optional boolean to indicate of cells will be cloned.

    Returns mxCell

getEdgeValidationError

  • Returns the validation error message to be displayed when inserting or changing an edges' connectivity. A return value of null means the edge is valid, a return value of '' means it's not valid, but do not display an error message. Any other (non-empty) string returned from this method is displayed as an error message when trying to connect an edge to a source and target. This implementation uses the multiplicities, and checks multigraph, allowDanglingEdges and allowLoops to generate validation errors.

    For extending this method with specific checks for source/target cells, the method can be extended as follows. Returning an empty string means the edge is invalid with no error message, a non-null string specifies the error message, and null means the edge is valid.

    graph.getEdgeValidationError = function(edge, source, target)
    {
      if (source != null && target != null &&
        this.model.getValue(source) != null &&
        this.model.getValue(target) != null)
      {
        if (target is not valid for source)
        {
          return 'Invalid Target';
        }
      }
    
      // "Supercall"
      return getEdgeValidationError.apply(this, arguments);
    }
    

    Parameters

    Returns string

getEdges

  • getEdges(cell: mxCell, parent?: mxCell, incoming?: boolean, outgoing?: boolean, includeLoops?: boolean, recurse?: boolean): mxCell[]
  • Returns the incoming and/or outgoing edges for the given cell. If the optional parent argument is specified, then only edges are returned where the opposite is in the given parent cell. If at least one of incoming or outgoing is true, then loops are ignored, if both are false, then all edges connected to the given cell are returned including loops.

    Parameters

    • cell: mxCell

      mxCell whose edges should be returned.

    • Optional parent: mxCell

      Optional parent of the opposite end for an edge to be returned.

    • Optional incoming: boolean

      Optional boolean that specifies if incoming edges should be included in the result. Default is true.

    • Optional outgoing: boolean

      Optional boolean that specifies if outgoing edges should be included in the result. Default is true.

    • Optional includeLoops: boolean

      Optional boolean that specifies if loops should be included in the result. Default is true.

    • Optional recurse: boolean

      Optional boolean the specifies if the parent specified only need be an ancestral parent, true, or the direct parent, false. Default is false

    Returns mxCell[]

getEdgesBetween

  • Returns the edges between the given source and target. This takes into account collapsed and invisible cells and returns the connected edges as displayed on the screen.

    source - target - directed -

    Parameters

    Returns mxCell[]

getEditingValue

  • getEditingValue(cell: mxCell, evt: MouseEvent): string
  • Returns the initial value for in-place editing. This implementation returns convertValueToString for the given cell. If this function is overridden, then mxGraphModel.valueForCellChanged should take care of correctly storing the actual new value inside the user object.

    Parameters

    • cell: mxCell

      mxCell for which the initial editing value should be returned.

    • evt: MouseEvent

      Optional mouse event that triggered the editor.

    Returns string

getEventSource

  • getEventSource(): any

getEventState

getExportableCells

getFoldableCells

  • getFoldableCells(cells: mxCell[], collapse: boolean): mxCell[]

getFoldingImage

getGraphBounds

getGridSize

  • getGridSize(): number

getImage

getImageFromBundles

  • getImageFromBundles(key: string): string
  • Searches all imageBundles for the specified key and returns the value for the first match or null if the key is not found.

    Parameters

    • key: string

    Returns string

getImportableCells

getIncomingEdges

  • Returns the visible incoming edges for the given cell. If the optional parent argument is specified, then only child edges of the given parent are returned.

    Parameters

    • cell: mxCell

      mxCell whose incoming edges should be returned.

    • parent: mxCell

      Optional parent of the opposite end for an edge to be returned.

    Returns mxCell[]

getIndicatorColor

getIndicatorGradientColor

  • getIndicatorGradientColor(state: mxCellState): string

getIndicatorImage

getIndicatorShape

getLabel

  • getLabel(cell: mxCell): string | Node
  • Returns a string or DOM node that represents the label for the given cell. This implementation uses convertValueToString if labelsVisible is true. Otherwise it returns an empty string.

    To truncate a label to match the size of the cell, the following code can be used.

    graph.getLabel = function(cell)
    {
      var label = getLabel.apply(this, arguments);
    
      if (label != null && this.model.isVertex(cell))
      {
        var geo = this.getCellGeometry(cell);
    
        if (geo != null)
        {
          var max = parseInt(geo.width / 8);
    
          if (label.length > max)
          {
            label = label.substring(0, max)+'...';
          }
        }
      }
      return mxUtils.htmlEntities(label);
    }
    

    A resize listener is needed in the graph to force a repaint of the label after a resize.

    graph.addListener(mxEvent.RESIZE_CELLS, function(sender, evt)
    {
      var cells = evt.getProperty('cells');
    
      for (var i = 0; i < cells.length; i++)
      {
        this.view.removeState(cells[i]);
      }
    });
    

    Parameters

    Returns string | Node

getLinkForCell

  • getLinkForCell(cell: mxCell): any
  • Returns the string to be used as the link for the given cell. This implementation returns null.

    Parameters

    Returns any

getMaximumGraphBounds

getModel

getMovableCells

getOpposites

  • Returns all distinct visible opposite cells for the specified terminal on the given edges.

    Parameters

    • edges: mxCell[]

      Array of mxCell that contains the edges whose opposite terminals should be returned.

    • terminal: mxCellState

      Terminal that specifies the end whose opposite should be returned.

    • Optional sources: boolean

      Optional boolean that specifies if source terminals should be included in the result. Default is true.

    • Optional targets: boolean

      Optional boolean that specifies if targer terminals should be included in the result. Default is true.

    Returns mxCellState[]

getOutgoingEdges

  • Returns the visible outgoing edges for the given cell. If the optional parent argument is specified, then only child edges of the given parent are returned.

    Parameters

    • cell: mxCell

      mxCell whose outgoing edges should be returned.

    • Optional parent: mxCell

      Optional parent of the opposite end for an edge to be returned.

    Returns mxCell[]

getOutlineConstraint

getOverlap

  • getOverlap(cell: mxCell): number
  • Returns a decimal number representing the amount of the width and height of the given cell that is allowed to overlap its parent. A value of 0 means all children must stay inside the parent, 1 means the child is allowed to be placed outside of the parent such that it touches one of the parents sides. If isAllowOverlapParent returns false for the given cell, then this method returns 0.

    Parameters

    • cell: mxCell

      mxCell for which the overlap ratio should be returned.

    Returns number

getPointForEvent

  • getPointForEvent(evt: MouseEvent, addOffset: boolean): mxPoint
  • Returns an mxPoint representing the given event in the unscaled, non-translated coordinate space of container and applies the grid.

    Parameters

    • evt: MouseEvent

      Mousevent that contains the mouse pointer location.

    • addOffset: boolean

      Optional boolean that specifies if the position should be offset by half of the gridSize. Default is true.

    Returns mxPoint

getPreferredPageSize

getPreferredSizeForCell

  • Returns the preferred width and height of the given mxCell as an mxRectangle. To implement a minimum width, add a new style eg. minWidth in the vertex and override this method as follows.

    var graphGetPreferredSizeForCell = graph.getPreferredSizeForCell;
    graph.getPreferredSizeForCell = function(cell)
    {
      var result = graphGetPreferredSizeForCell.apply(this, arguments);
      var style = this.getCellStyle(cell);
    
      if (style['minWidth'] > 0)
      {
        result.width = Math.max(style['minWidth'], result.width);
      }
    
      return result;
    };
    

    Parameters

    • cell: mxCell

      mxCell for which the preferred size should be returned.

    • Optional textWidth: number

      Optional maximum text width for word wrapping.

    Returns mxRectangle

getSelectionCell

getSelectionCells

  • getSelectionCells(): mxCell[]

getSelectionCellsForChanges

getSelectionCount

  • getSelectionCount(): number

getSelectionModel

getStartSize

  • Returns the start size of the given swimlane, that is, the width or height of the part that contains the title, depending on the horizontal style. The return value is an mxRectangle with either width or height set as appropriate.

    Parameters

    • swimlane: mxCell

      mxCell whose start size should be returned.

    • Optional ignoreState: boolean

      Optional boolean that specifies if cell state should be ignored.

    Returns mxRectangle

getStateForTouchEvent

  • getStateForTouchEvent(evt: MouseEvent | TouchEvent): mxCellState

getStylesheet

getSwimlane

  • Returns the nearest ancestor of the given cell which is a swimlane, or the given cell, if it is itself a swimlane.

    Parameters

    • cell: mxCell

      mxCell for which the ancestor swimlane should be returned.

    Returns mxCell

getSwimlaneAt

  • getSwimlaneAt(x: number, y: number, parent: mxCell): mxCell
  • Returns the bottom-most swimlane that intersects the given point (x, y) in the cell hierarchy that starts at the given parent.

    Parameters

    • x: number

      X-coordinate of the location to be checked.

    • y: number

      Y-coordinate of the location to be checked.

    • parent: mxCell

      mxCell that should be used as the root of the recursion. Default is defaultParent.

    Returns mxCell

getSwimlaneDirection

  • getSwimlaneDirection(style: string): string
  • Returns the direction for the given swimlane style.

    Parameters

    • style: string

    Returns string

getTerminalForPort

  • Returns the terminal to be used for a given port. This implementation always returns the parent cell.

    Parameters

    • cell: mxCell

      mxCell that represents the port.

    • source: boolean

      If the cell is the source or target port.

    Returns mxCell

getTolerance

  • getTolerance(): number

getTooltip

  • getTooltip(state: mxCellState, node: Node, x: number, y: number): string
  • Returns the string or DOM node that represents the tooltip for the given state, node and coordinate pair. This implementation checks if the given node is a folding icon or overlay and returns the respective tooltip. If this does not result in a tooltip, the handler for the cell is retrieved from selectionCellsHandler and the optional getTooltipForNode method is called. If no special tooltip exists here then getTooltipForCell is used with the cell in the given state as the argument to return a tooltip for the given state.

    Parameters

    • state: mxCellState

      mxCellState whose tooltip should be returned.

    • node: Node

      DOM node that is currently under the mouse.

    • x: number

      X-coordinate of the mouse.

    • y: number

      Y-coordinate of the mouse.

    Returns string

getTooltipForCell

  • getTooltipForCell(cell: mxCell): string
  • Returns the string or DOM node to be used as the tooltip for the given cell. This implementation uses the cells getTooltip function if it exists, or else it returns convertValueToString for the cell.

    example
    graph.getTooltipForCell = function(cell)
    {
      return 'Hello, World!';
    }
    

    Replaces all tooltips with the string Hello, World!

    Parameters

    Returns string

getTranslateForRoot

  • Returns the translation to be used if the given cell is the root cell as an mxPoint. This implementation returns null.

    To keep the children at their absolute position while stepping into groups, this function can be overridden as follows.

    example
    var offset = new mxPoint(0, 0);
    
    while (cell != null)
    {
      var geo = this.model.getGeometry(cell);
    
      if (geo != null)
      {
        offset.x -= geo.x;
        offset.y -= geo.y;
      }
    
      cell = this.model.getParent(cell);
    }
    
    return offset;
    

    Parameters

    Returns mxPoint

getVerticalAlign

getView

graphModelChanged

  • graphModelChanged(changes: any[]): void
  • Called when the graph model changes. Invokes processChange on each item of the given array to update the view accordingly.

    Parameters

    • changes: any[]

      Array that contains the individual changes.

    Returns void

groupCells

  • Adds the cells into the given group. The change is carried out using cellsAdded, cellsMoved and cellsResized. This method fires mxEvent.GROUP_CELLS while the transaction is in progress. Returns the new group. A group is only created if there is at least one entry in the given array of cells.

    Parameters

    • group: null | mxCell

      mxCell that represents the target group. If null is specified then a new group is created using createGroupCell.

    • Optional border: number

      Optional integer that specifies the border between the child area and the group bounds. Default is 0.

    • Optional cells: mxCell[]

      Optional array of mxCell to be grouped. If null is specified then the selection cells are used.

    Returns mxCell

hitsSwimlaneContent

  • hitsSwimlaneContent(swimlane: mxCell, x: number, y: number): boolean
  • Returns true if the given coordinate pair is inside the content are of the given swimlane.

    Parameters

    • swimlane: mxCell

      mxCell that specifies the swimlane.

    • x: number

      X-coordinate of the mouse event.

    • y: number

      Y-coordinate of the mouse event.

    Returns boolean

home

  • home(): void
  • Uses the root of the model as the root of the displayed cell hierarchy and selects the previous root.

    Returns void

importCells

  • importCells(cells: mxCell[], dx: number, dy: number, target: mxCell, evt?: Event, mapping?: any): mxCell[]
  • Clones and inserts the given cells into the graph using the move method and returns the inserted cells. This shortcut is used if cells are inserted via datatransfer.

    Parameters

    • cells: mxCell[]

      Array of mxCell to be imported.

    • dx: number

      Integer that specifies the x-coordinate of the vector. Default is 0.

    • dy: number

      Integer that specifies the y-coordinate of the vector. Default is 0.

    • target: mxCell

      mxCell that represents the new parent of the cells.

    • Optional evt: Event

      Mouseevent that triggered the invocation.

    • Optional mapping: any

      Optional mapping for existing clones.

    Returns mxCell[]

init

  • init(container: HTMLElement): void
  • Initializes the container and creates the respective datastructures.

    Parameters

    • container: HTMLElement

      DOM node that will contain the graph display.

    Returns void

insertEdge

  • Adds a new edge into the given parent mxCell using value as the user object and the given source and target as the terminals of the new edge. The id and style are used for the respective properties of the new mxCell, which is returned.

    Parameters

    • parent: mxCell

      mxCell that specifies the parent of the new edge.

    • id: null | string

      Optional string that defines the Id of the new edge.

    • value: any

      JavaScript object to be used as the user object.

    • source: mxCell

      mxCell that defines the source of the edge.

    • target: mxCell

      mxCell that defines the target of the edge.

    • Optional style: string

      Optional string that defines the cell style.

    Returns mxCell

insertVertex

  • insertVertex(parent: mxCell, id: null | string, value: any, x: number, y: number, width: number, height: number, style?: string, relative?: boolean): mxCell
  • Adds a new vertex into the given parent mxCell using value as the user object and the given coordinates as the mxGeometry of the new vertex. The id and style are used for the respective properties of the new mxCell, which is returned.

    When adding new vertices from a mouse event, one should take into account the offset of the graph container and the scale and translation of the view in order to find the correct unscaled, untranslated coordinates using mxGraph.getPointForEvent as follows:

    var pt = graph.getPointForEvent(evt);
    var parent = graph.getDefaultParent();
    graph.insertVertex(parent, null,
                'Hello, World!', x, y, 220, 30);
    

    For adding image cells, the style parameter can be assigned as

    stylename;image=imageUrl
    

    See mxGraph for more information on using images.

    Parameters

    • parent: mxCell

      mxCell that specifies the parent of the new vertex.

    • id: null | string

      Optional string that defines the Id of the new vertex.

    • value: any

      Object to be used as the user object.

    • x: number

      Integer that defines the x coordinate of the vertex.

    • y: number

      Integer that defines the y coordinate of the vertex.

    • width: number

      Integer that defines the width of the vertex.

    • height: number

      Integer that defines the height of the vertex.

    • Optional style: string

      Optional string that defines the cell style.

    • Optional relative: boolean

      Optional boolean that specifies if the geometry is relative. Default is false.

    Returns mxCell

intersects

  • Returns the bottom-most cell that intersects the given point (x, y) in the cell hierarchy that starts at the given parent.

    Parameters

    • state: mxCellState

      mxCellState that represents the cell state.

    • x: number

      X-coordinate of the location to be checked.

    • y: number

      Y-coordinate of the location to be checked.

    Returns mxCell

isAllowDanglingEdges

  • isAllowDanglingEdges(): boolean

isAllowLoops

  • isAllowLoops(): boolean

isAllowNegativeCoordinates

  • isAllowNegativeCoordinates(): boolean

isAllowOverlapParent

  • isAllowOverlapParent(cell: mxCell): boolean
  • Returns true if the given cell is allowed to be placed outside of the parents area.

    Parameters

    • cell: mxCell

      mxCell that represents the child to be checked.

    Returns boolean

isAutoSizeCell

  • isAutoSizeCell(cell: mxCell): boolean

isAutoSizeCells

  • isAutoSizeCells(): boolean

isCellBendable

  • isCellBendable(cell: mxCell): boolean

isCellCloneable

  • isCellCloneable(cell: mxCell): boolean

isCellCollapsed

  • isCellCollapsed(cell: mxCell): boolean
  • Returns true if the given cell is collapsed in this graph. This implementation uses mxGraphModel.isCollapsed. Subclassers can override this to implement specific collapsed states for cells in only one graph, that is, without affecting the collapsed state of the cell.

    When using dynamic filter expressions for the collapsed state, then the graph should be revalidated after the filter expression has changed.

    Parameters

    • cell: mxCell

      mxCell whose collapsed state should be returned.

    Returns boolean

isCellConnectable

  • isCellConnectable(cell: mxCell): boolean
  • Returns true if the given cell is connectable in this graph. This implementation uses mxGraphModel.isConnectable. Subclassers can override this to implement specific connectable states for cells in only one graph, that is, without affecting the connectable state of the cell in the model.

    Parameters

    • cell: mxCell

      mxCell whose connectable state should be returned.

    Returns boolean

isCellDeletable

  • isCellDeletable(cell: mxCell): boolean

isCellDisconnectable

  • isCellDisconnectable(cell: mxCell, terminal: mxCell, source?: boolean): boolean
  • Returns true if the given cell is disconnectable from the source or target terminal. This returns isCellsDisconnectable for all given cells if isCellLocked does not return true for the given cell.

    Parameters

    • cell: mxCell

      mxCell whose disconnectable state should be returned.

    • terminal: mxCell

      mxCell that represents the source or target terminal.

    • Optional source: boolean

      Boolean indicating if the source or target terminal is to be disconnected.

    Returns boolean

isCellEditable

  • isCellEditable(cell: mxCell): boolean

isCellFoldable

  • isCellFoldable(cell: mxCell, collapse: boolean): boolean
  • Returns true if the given cell is foldable. This implementation returns true if the cell has at least one child and its style does not specify mxConstants.STYLE_FOLDABLE to be 0.

    Parameters

    • cell: mxCell

      mxCell whose foldable state should be returned.

    • collapse: boolean

    Returns boolean

isCellLocked

  • isCellLocked(cell: mxCell): boolean
  • Returns true if the given cell may not be moved, sized, bended, disconnected, edited or selected. This implementation returns true for all vertices with a relative geometry if {@link locked} is false.

    Parameters

    • cell: mxCell

      mxCell whose locked state should be returned.

    Returns boolean

isCellMovable

  • isCellMovable(cell: mxCell): boolean

isCellResizable

  • isCellResizable(cell: mxCell): boolean

isCellRotatable

  • isCellRotatable(cell: mxCell): boolean

isCellSelectable

  • isCellSelectable(cell: mxCell): boolean
  • Returns true if the given cell is selectable. This implementation returns cellsSelectable.

    To add a new style for making cells (un)selectable, use the following code.

    isCellSelectable = function(cell)
    {
      var style = this.getCurrentCellStyle(cell);
    
      return this.isCellsSelectable() && !this.isCellLocked(cell) && style['selectable'] != 0;
    };
    

    You can then use the new style as shown in this example.

    graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30, 'selectable=0');
    

    Parameters

    • cell: mxCell

      mxCell whose selectable state should be returned.

    Returns boolean

isCellSelected

  • isCellSelected(cell: mxCell): boolean
  • Returns true if the given cell is selected.

    Parameters

    • cell: mxCell

      mxCell for which the selection state should be returned.

    Returns boolean

isCellVisible

  • isCellVisible(cell: mxCell): boolean
  • Returns true if the given cell is visible in this graph. This implementation uses mxGraphModel.isVisible. Subclassers can override this to implement specific visibility for cells in only one graph, that is, without affecting the visible state of the cell.

    When using dynamic filter expressions for cell visibility, then the graph should be revalidated after the filter expression has changed.

    Parameters

    • cell: mxCell

      mxCell whose visible state should be returned.

    Returns boolean

isCellsBendable

  • isCellsBendable(): boolean

isCellsCloneable

  • isCellsCloneable(): boolean

isCellsDeletable

  • isCellsDeletable(): boolean

isCellsDisconnectable

  • isCellsDisconnectable(): boolean

isCellsEditable

  • isCellsEditable(): boolean

isCellsLocked

  • isCellsLocked(): boolean
  • Returns true if the given cell may not be moved, sized, bended, disconnected, edited or selected. This implementation returns true for all vertices with a relative geometry if {@link locked} is false.

    Returns boolean

isCellsMovable

  • isCellsMovable(): boolean

isCellsResizable

  • isCellsResizable(): boolean

isCellsSelectable

  • isCellsSelectable(): boolean

isCloneEvent

  • isCloneEvent(evt: MouseEvent): boolean
  • Returns true if the given event is a clone event. This implementation returns true if control is pressed.

    Parameters

    • evt: MouseEvent

    Returns boolean

isCloneInvalidEdges

  • isCloneInvalidEdges(): boolean

isConnectable

  • isConnectable(): boolean

isConnectableEdges

  • isConnectableEdges(): boolean

isConstrainChild

  • isConstrainChild(cell: mxCell): boolean

isConstrainChildren

  • isConstrainChildren(): boolean

isConstrainRelativeChildren

  • isConstrainRelativeChildren(): boolean

isConstrainedEvent

  • isConstrainedEvent(evt: MouseEvent): boolean
  • Returns true if the given mouse event should be aligned to the grid.

    Parameters

    • evt: MouseEvent

    Returns boolean

isDisconnectOnMove

  • isDisconnectOnMove(): boolean

isDropEnabled

  • isDropEnabled(): boolean

isEdgeLabelsMovable

  • isEdgeLabelsMovable(): boolean

isEdgeValid

isEditing

  • isEditing(cell?: mxCell): boolean
  • Returns true if the given cell is currently being edited. If no cell is specified then this returns true if any cell is currently being edited.

    Parameters

    Returns boolean

isEnabled

  • isEnabled(): boolean

isEnterStopsCellEditing

  • isEnterStopsCellEditing(): boolean

isEscapeEnabled

  • isEscapeEnabled(): boolean

isEventIgnored

isEventSourceIgnored

  • isEventSourceIgnored(evtName: string, me: mxMouseEvent): boolean
  • Returns true if the event should be ignored in fireMouseEvent. This implementation returns true for select, option and input (if not of type checkbox, radio, button, submit or file) event sources if the event is not a mouse event or a left mouse button press event.

    Parameters

    Returns boolean

isEventsEnabled

  • isEventsEnabled(): boolean

isExtendParent

  • isExtendParent(cell: mxCell): boolean
  • Returns true if the parent of the given cell should be extended if the child has been resized so that it overlaps the parent. This implementation returns isExtendParents if the cell is not an edge.

    Parameters

    Returns boolean

isExtendParents

  • isExtendParents(): boolean

isExtendParentsOnAdd

  • isExtendParentsOnAdd(cell: mxCell): boolean

isExtendParentsOnMove

  • isExtendParentsOnMove(): boolean

isGridEnabled

  • isGridEnabled(): boolean

isGridEnabledEvent

  • isGridEnabledEvent(evt: MouseEvent): boolean
  • Returns true if the given mouse event should be aligned to the grid.

    Parameters

    • evt: MouseEvent

    Returns boolean

isHtmlLabel

  • isHtmlLabel(cell: mxCell): boolean
  • Returns true if the label must be rendered as HTML markup. The default implementation returns htmlLabels.

    Parameters

    • cell: mxCell

      mxCell whose label should be displayed as HTML markup.

    Returns boolean

isHtmlLabels

  • isHtmlLabels(): boolean

isIgnoreTerminalEvent

  • isIgnoreTerminalEvent(evt: MouseEvent): boolean
  • Returns true if the given mouse event should not allow any connections to be made. This implementation returns false.

    Parameters

    • evt: MouseEvent

    Returns boolean

isInvokesStopCellEditing

  • isInvokesStopCellEditing(): boolean

isLabelClipped

  • isLabelClipped(cell: mxCell): boolean
  • Returns true if the overflow portion of labels should be hidden. If this returns true then vertex labels will be clipped to the size of the vertices. This implementation returns true if mxConstants.STYLE_OVERFLOW in the style of the given cell is 'hidden'.

    Parameters

    Returns boolean

isLabelMovable

  • isLabelMovable(cell: mxCell): boolean
  • Returns true if the given edges's label is moveable. This returns {@link movable} for all given cells if {@link isLocked} does not return true for the given cell.

    Parameters

    Returns boolean

isLoop

isMultigraph

  • isMultigraph(): boolean

isOrthogonal

  • Returns true if perimeter points should be computed such that the resulting edge has only horizontal or vertical segments.

    Parameters

    Returns boolean

isPort

  • isPort(cell: mxCell): boolean
  • Returns true if the given cell is a "port", that is, when connecting to it, the cell returned by getTerminalForPort should be used as the terminal and the port should be referenced by the ID in either the mxConstants.STYLE_SOURCE_PORT or the or the mxConstants.STYLE_TARGET_PORT. Note that a port should not be movable. This implementation always returns false.

    A typical implementation is the following:

    graph.isPort = function(cell)
    {
      var geo = this.getCellGeometry(cell);
    
      return (geo != null) ? geo.relative : false;
    };
    

    Parameters

    Returns boolean

isPortsEnabled

  • isPortsEnabled(): boolean

isRecursiveResize

isResizeContainer

  • isResizeContainer(): boolean

isSelectionEmpty

  • isSelectionEmpty(): boolean

isSiblingSelected

  • isSiblingSelected(cell: mxCell): boolean

isSplitEnabled

  • isSplitEnabled(): boolean

isSplitTarget

  • isSplitTarget(target: mxCell, cells: mxCell[], evt: Event): boolean
  • Returns true if the given edge may be splitted into two edges with the given cell as a new terminal between the two.

    Parameters

    • target: mxCell

      mxCell that represents the edge to be splitted.

    • cells: mxCell[]

      mxCell that should split the edge.

    • evt: Event

      Mouseevent that triggered the invocation.

    Returns boolean

isSwimlane

  • isSwimlane(cell: mxCell, ignoreState?: boolean): boolean
  • Returns true if the given cell is a swimlane in the graph. A swimlane is a container cell with some specific behaviour. This implementation checks if the shape associated with the given cell is a mxSwimlane.

    Parameters

    • cell: mxCell

      mxCell to be checked.

    • Optional ignoreState: boolean

      Optional boolean that specifies if the cell state should be ignored.

    Returns boolean

isSwimlaneNesting

  • isSwimlaneNesting(): boolean

isSwimlaneSelectionEnabled

  • isSwimlaneSelectionEnabled(): boolean

isSyntheticEventIgnored

isTerminalPointMovable

  • isTerminalPointMovable(cell: mxCell, source?: boolean): boolean
  • Returns true if the given terminal point is movable. This is independent from isCellConnectable and isCellDisconnectable and controls if terminal points can be moved in the graph if the edge is not connected. Note that it is required for this to return true to connect unconnected edges. This implementation returns true.

    Parameters

    • cell: mxCell

      mxCell whose terminal point should be moved.

    • Optional source: boolean

      Boolean indicating if the source or target terminal should be moved.

    Returns boolean

isToggleEvent

  • isToggleEvent(evt: MouseEvent): boolean
  • Returns true if the given event is a toggle event. This implementation returns true if the meta key (Cmd) is pressed on Macs or if control is pressed on any other platform.

    Parameters

    • evt: MouseEvent

    Returns boolean

isTransparentClickEvent

  • isTransparentClickEvent(evt: MouseEvent): boolean
  • Hook for implementing click-through behaviour on selected cells. If this returns true the cell behind the selected cell will be selected. This implementation returns false;

    Parameters

    • evt: MouseEvent

    Returns boolean

isTransparentState

isValidAncestor

  • isValidAncestor(cell: mxCell, parent: mxCell, recurse?: boolean): boolean
  • Returns whether or not the specified parent is a valid ancestor of the specified cell, either direct or indirectly based on whether ancestor recursion is enabled.

    Parameters

    • cell: mxCell

      mxCell the possible child cell

    • parent: mxCell

      mxCell the possible parent cell

    • Optional recurse: boolean

      boolean whether or not to recurse the child ancestors

    Returns boolean

isValidConnection

  • isValidConnection(source: mxCell, target: mxCell): boolean
  • Returns true if the given target cell is a valid target for source. This is a boolean implementation for not allowing connections between certain pairs of vertices and is called by getEdgeValidationError. This implementation returns true if isValidSource returns true for the source and isValidTarget returns true for the target.

    Parameters

    Returns boolean

isValidDropTarget

  • isValidDropTarget(cell: mxCell, cells: mxCell[], evt: Event): boolean
  • Returns true if the given cell is a valid drop target for the specified cells. If splitEnabled is true then this returns isSplitTarget for the given arguments else it returns true if the cell is not collapsed and its child count is greater than 0.

    Parameters

    • cell: mxCell

      mxCell that represents the possible drop target.

    • cells: mxCell[]

      mxCell that should be dropped into the target.

    • evt: Event

      Mouseevent that triggered the invocation.

    Returns boolean

isValidRoot

  • isValidRoot(cell: mxCell): boolean
  • Returns true if the given cell is a valid root for the cell display hierarchy. This implementation returns true for all non-null values.

    Parameters

    • cell: mxCell

      mxCell which should be checked as a possible root.

    Returns boolean

isValidSource

  • isValidSource(cell: mxCell): boolean
  • Returns true if the given cell is a valid source for new connections. This implementation returns true for all non-null values and is called by is called by isValidConnection.

    Parameters

    • cell: mxCell

      mxCell that represents a possible source or null.

    Returns boolean

isValidTarget

  • isValidTarget(cell: mxCell): boolean

isVertexLabelsMovable

  • isVertexLabelsMovable(): boolean

isWrapping

  • isWrapping(cell: mxCell): boolean
  • This enables wrapping for HTML labels.

    Returns true if no white-space CSS style directive should be used for displaying the given cells label. This implementation returns true if mxConstants.STYLE_WHITE_SPACE in the style of the given cell is 'wrap'.

    This is used as a workaround for IE ignoring the white-space directive of child elements if the directive appears in a parent element. It should be overridden to return true if a white-space directive is used in the HTML markup that represents the given cells label. In order for HTML markup to work in labels, isHtmlLabel must also return true for the given cell.

    example
    graph.getLabel = function(cell)
    {
      var tmp = getLabel.apply(this, arguments); // "supercall"
    
      if (this.model.isEdge(cell))
      {
        tmp = '<div style="width: 150px; white-space:normal;">'+tmp+'</div>';
      }
    
      return tmp;
    }
    
    graph.isWrapping = function(state)
    {
         return this.model.isEdge(state.cell);
    }
    

    Makes sure no edge label is wider than 150 pixels, otherwise the content is wrapped. Note: No width must be specified for wrapped vertex labels as the vertex defines the width in its geometry.

    Parameters

    Returns boolean

labelChanged

  • labelChanged(cell: mxCell, value: any, evt?: MouseEvent): mxCell
  • Sets the label of the specified cell to the given value using cellLabelChanged and fires mxEvent.LABEL_CHANGED while the transaction is in progress. Returns the cell whose label was changed.

    Parameters

    • cell: mxCell

      mxCell whose label should be changed.

    • value: any

      New label to be assigned.

    • Optional evt: MouseEvent

      Optional event that triggered the change.

    Returns mxCell

moveCells

  • moveCells(cells: mxCell[], dx: number, dy: number, clone: boolean, target?: mxCell, evt?: Event, mapping?: any): mxCell[]
  • Moves or clones the specified cells and moves the cells or clones by the given amount, adding them to the optional target cell. The evt is the mouse event as the mouse was released. The change is carried out using cellsMoved. This method fires mxEvent.MOVE_CELLS while the transaction is in progress. Returns the cells that were moved.

    Use the following code to move all cells in the graph.

    graph.moveCells(graph.getChildCells(null, true, true), 10, 10);
    

    Parameters

    • cells: mxCell[]

      Array of mxCell to be moved, cloned or added to the target.

    • dx: number

      Integer that specifies the x-coordinate of the vector. Default is 0.

    • dy: number

      Integer that specifies the y-coordinate of the vector. Default is 0.

    • clone: boolean

      Boolean indicating if the cells should be cloned. Default is false.

    • Optional target: mxCell

      mxCell that represents the new parent of the cells.

    • Optional evt: Event

      Mouseevent that triggered the invocation.

    • Optional mapping: any

      Optional mapping for existing clones.

    Returns mxCell[]

orderCells

  • Moves the given cells to the front or back. The change is carried out using cellsOrdered. This method fires mxEvent.ORDER_CELLS while the transaction is in progress.

    Parameters

    • back: boolean

      Boolean that specifies if the cells should be moved to back.

    • Optional cells: mxCell[]

      Array of mxCell to move to the background. If null is specified then the selection cells are used.

    Returns mxCell[]

panGraph

  • panGraph(dx: number, dy: number): void
  • Shifts the graph display by the given amount. This is used to preview panning operations, use mxGraphView.setTranslate to set a persistent translation of the view. Fires mxEvent.PAN.

    Parameters

    • dx: number

      Amount to shift the graph along the x-axis.

    • dy: number

      Amount to shift the graph along the y-axis.

    Returns void

postProcessCellStyle

  • Tries to resolve the value for the image style in the image bundles and turns short data URIs as defined in mxImageBundle to data URIs as defined in RFC 2397 of the IETF.

    Parameters

    Returns StyleMap

processChange

  • processChange(change: any): void
  • Processes the given change and invalidates the respective cached data in view. This fires a {@link root} event if the root has changed in the model.

    Parameters

    • change: any

      Object that represents the change on the model.

    Returns void

refresh

  • refresh(cell?: mxCell): void
  • Clears all cell states or the states for the hierarchy starting at the given cell and validates the graph. This fires a refresh event as the last step.

    Parameters

    • Optional cell: mxCell

      Optional mxCell for which the cell states should be cleared.

    Returns void

removeCellOverlay

removeCellOverlays

  • Removes all {@link mxCellOverlays} from the given cell. This method fires a {@link removeoverlay} event for each mxCellOverlay and returns the array of {@link mxCellOverlays} that was removed from the cell.

    Parameters

    Returns mxCellOverlay[]

removeCells

  • removeCells(cells: mxCell[], includeEdges?: boolean): mxCell[]
  • Removes the given cells from the graph including all connected edges if includeEdges is true. The change is carried out using cellsRemoved. This method fires mxEvent.REMOVE_CELLS while the transaction is in progress. The removed cells are returned as an array.

    Parameters

    • cells: mxCell[]

      Array of mxCell to remove. If null is specified then the selection cells which are deletable are used.

    • Optional includeEdges: boolean

      Optional boolean which specifies if all connected edges should be removed as well. Default is true.

    Returns mxCell[]

removeCellsAfterUngroup

  • removeCellsAfterUngroup(cells: mxCell[]): void

removeCellsFromParent

  • Removes the specified cells from their parents and adds them to the default parent. Returns the cells that were removed from their parents.

    Parameters

    • cells: mxCell[]

      Array of mxCell to be removed from their parents.

    Returns mxCell[]

removeImageBundle

removeListener

  • removeListener(funct: (...args: any[]) => any): void
  • Function: removeListener

    Removes all occurrences of the given listener from .

    Parameters

    • funct: (...args: any[]) => any
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns void

removeMouseListener

  • removeMouseListener(listener: {}): void

removeSelectionCell

  • removeSelectionCell(cell: mxCell): void

removeSelectionCells

  • removeSelectionCells(cells: mxCell[]): void

removeStateForCell

  • removeStateForCell(cell: mxCell): void
  • Removes all cached information for the given cell and its descendants. This is called when a cell was removed from the model.

    Paramters:

    Parameters

    Returns void

resetEdge

resetEdges

  • resetEdges(cells: mxCell[]): void
  • Resets the control points of the edges that are connected to the given cells if not both ends of the edge are in the given cells array.

    Parameters

    • cells: mxCell[]

      Array of mxCell for which the connected edges should be reset.

    Returns void

resizeCell

resizeCells

  • Sets the bounds of the given cells and fires a mxEvent.RESIZE_CELLS event while the transaction is in progress. Returns the cells which have been passed to the function.

    Parameters

    • cells: mxCell[]

      Array of mxCell whose bounds should be changed.

    • bounds: mxRectangle[]

      Array of {@link mxRectangles} that represent the new bounds.

    • recurse: boolean

    Returns mxCell[]

resizeChildCells

  • Resizes the child cells of the given cell for the given new geometry with respect to the current geometry of the cell.

    Parameters

    Returns void

scaleCell

  • scaleCell(cell: mxCell, dx: number, dy: number, recurse?: boolean): void
  • Scales the points, position and size of the given cell according to the given vertical and horizontal scaling factors.

    Parameters

    • cell: mxCell

      mxCell whose geometry should be scaled.

    • dx: number

      Horizontal scaling factor.

    • dy: number

      Vertical scaling factor.

    • Optional recurse: boolean

      Boolean indicating if the child cells should be scaled.

    Returns void

scrollCellToVisible

  • scrollCellToVisible(cell: mxCell, center?: boolean): void
  • Pans the graph so that it shows the given cell. Optionally the cell may be centered in the container.

    To center a given graph if the container has no scrollbars, use the following code.

    [code] var bounds = graph.getGraphBounds(); graph.view.setTranslate(-bounds.x - (bounds.width - container.clientWidth) / 2, -bounds.y - (bounds.height - container.clientHeight) / 2); [/code]

    Parameters

    • cell: mxCell

      mxCell to be made visible.

    • Optional center: boolean

      Optional boolean flag. Default is false.

    Returns void

scrollPointToVisible

  • scrollPointToVisible(x: number, y: number, extend?: boolean, border?: number): void
  • Scrolls the graph to the given point, extending the graph container if specified.

    Parameters

    • x: number
    • y: number
    • Optional extend: boolean
    • Optional border: number

    Returns void

scrollRectToVisible

selectAll

  • selectAll(parent: mxCell, descendants?: boolean): void
  • Selects all children of the given parent cell or the children of the default parent if no parent is specified. To select leaf vertices and/or edges use selectCells.

    Parameters

    • parent: mxCell

      Optional mxCell whose children should be selected. Default is defaultParent.

    • Optional descendants: boolean

      Optional boolean specifying whether all descendants should be selected. Default is false.

    Returns void

selectCell

  • selectCell(isNext?: boolean, isParent?: boolean, isChild?: boolean): void
  • Selects the next, parent, first child or previous cell, if all arguments are false.

    Parameters

    • Optional isNext: boolean

      Boolean indicating if the next cell should be selected.

    • Optional isParent: boolean

      Boolean indicating if the parent cell should be selected.

    • Optional isChild: boolean

      Boolean indicating if the first child cell should be selected.

    Returns void

selectCellForEvent

  • selectCellForEvent(cell: mxCell, evt?: MouseEvent): void
  • Selects the given cell by either adding it to the selection or replacing the selection depending on whether the given mouse event is a toggle event.

    Parameters

    • cell: mxCell

      mxCell to be selected.

    • Optional evt: MouseEvent

      Optional mouseevent that triggered the selection.

    Returns void

selectCells

  • selectCells(vertices: boolean, edges: boolean, parent?: mxCell, selectGroups?: boolean): void
  • Selects all vertices and/or edges depending on the given boolean arguments recursively, starting at the given parent or the default parent if no parent is specified. Use selectAll to select all cells. For vertices, only cells with no children are selected.

    Parameters

    • vertices: boolean

      Boolean indicating if vertices should be selected.

    • edges: boolean

      Boolean indicating if edges should be selected.

    • Optional parent: mxCell

      Optional mxCell that acts as the root of the recursion. Default is defaultParent.

    • Optional selectGroups: boolean

      Optional boolean that specifies if groups should be selected. Default is false.

    Returns void

selectCellsForEvent

  • selectCellsForEvent(cells: mxCell[], evt?: MouseEvent): void
  • Selects the given cells by either adding them to the selection or replacing the selection depending on whether the given mouse event is a toggle event.

    Parameters

    • cells: mxCell[]

      Array of mxCell to be selected.

    • Optional evt: MouseEvent

      Optional mouseevent that triggered the selection.

    Returns void

selectChildCell

  • selectChildCell(): void

selectEdges

  • selectEdges(parent: mxCell): void
  • Select all vertices inside the given parent or the default parent.

    Parameters

    Returns void

selectNextCell

  • selectNextCell(): void

selectParentCell

  • selectParentCell(): void

selectPreviousCell

  • selectPreviousCell(): void

selectRegion

  • Selects and returns the cells inside the given rectangle for the specified event.

    Parameters

    • rect: mxRectangle

      mxRectangle that represents the region to be selected.

    • evt: Event

      Mouseevent that triggered the selection.

    Returns mxCell[]

selectVertices

  • selectVertices(parent: mxCell, selectGroups: boolean): void
  • Select all vertices inside the given parent or the default parent.

    Parameters

    • parent: mxCell
    • selectGroups: boolean

    Returns void

setAllowDanglingEdges

  • setAllowDanglingEdges(value: boolean): void
  • Specifies if dangling edges are allowed, that is, if edges are allowed that do not have a source and/or target terminal defined.

    Parameters

    • value: boolean

      Boolean indicating if dangling edges are allowed.

    Returns void

setAllowLoops

  • setAllowLoops(value: boolean): void
  • Specifies if loops are allowed.

    Parameters

    • value: boolean

      Boolean indicating if loops are allowed.

    Returns void

setAllowNegativeCoordinates

  • setAllowNegativeCoordinates(value: boolean): void

setAutoSizeCells

  • setAutoSizeCells(value: boolean): void
  • Specifies if cell sizes should be automatically updated after a label change. This implementation sets autoSizeCells to the given parameter. To update the size of cells when the cells are added, set autoSizeCellsOnAdd to true.

    Parameters

    • value: boolean

      Boolean indicating if cells should be resized automatically.

    Returns void

setBackgroundImage

  • setBackgroundImage(image: mxImage): void

setBorder

  • setBorder(value: number): void
  • Sets the value of border.

    Parameters

    • value: number

      Positive integer that represents the border to be used.

    Returns void

setCellStyle

  • setCellStyle(style: string, cells?: mxCell[]): void
  • Sets the style of the specified cells. If no cells are given, then the selection cells are changed.

    Parameters

    • style: string

      String representing the new style of the cells.

    • Optional cells: mxCell[]

      Optional array of mxCell to set the style for. Default is the selection cells.

    Returns void

setCellStyleFlags

  • setCellStyleFlags(key: string, flag: number, value: boolean, cells?: mxCell[]): void
  • Sets or toggles the given bit for the given key in the styles of the specified cells.

    Parameters

    • key: string

      String representing the key to toggle the flag in.

    • flag: number

      Integer that represents the bit to be toggled.

    • value: boolean

      Boolean value to be used or null if the value should be toggled.

    • Optional cells: mxCell[]

      Optional array of mxCell to change the style for. Default is the selection cells.

    Returns void

setCellStyles

  • setCellStyles(key: string, value: any, cells?: mxCell[]): void
  • Sets the key to value in the styles of the given cells. This will modify the existing cell styles in-place and override any existing assignment for the given key. If no cells are specified, then the selection cells are changed. If no value is specified, then the respective key is removed from the styles.

    Parameters

    • key: string

      String representing the key to be assigned.

    • value: any

      String representing the new value for the key.

    • Optional cells: mxCell[]

      Optional array of mxCell to change the style for. Default is the selection cells.

    Returns void

setCellWarning

  • Creates an overlay for the given cell using the warning and image or warningImage and returns the new mxCellOverlay. The warning is displayed as a tooltip in a red font and may contain HTML markup. If the warning is null or a zero length string, then all overlays are removed from the cell.

    example
    graph.setCellWarning(cell, '{@link b}Warning:</b>: Hello, World!');
    

    Parameters

    • cell: mxCell

      mxCell whose warning should be set.

    • warning: string

      String that represents the warning to be displayed.

    • Optional img: mxImage

      Optional mxImage to be used for the overlay. Default is warningImage.

    • Optional isSelect: boolean

      Optional boolean indicating if a click on the overlay should select the corresponding cell. Default is false.

    Returns mxCellOverlay

setCellsBendable

  • setCellsBendable(value: boolean): void
  • Specifies if the graph should allow bending of edges. This implementation updates {@link bendable}.

    Parameters

    • value: boolean

      Boolean indicating if the graph should allow bending of edges.

    Returns void

setCellsCloneable

  • setCellsCloneable(value: boolean): void
  • Specifies if the graph should allow cloning of cells by holding down the control key while cells are being moved. This implementation updates cellsCloneable.

    Parameters

    • value: boolean

      Boolean indicating if the graph should be cloneable.

    Returns void

setCellsDeletable

  • setCellsDeletable(value: boolean): void

setCellsDisconnectable

  • setCellsDisconnectable(value: boolean): void

setCellsEditable

  • setCellsEditable(value: boolean): void
  • Specifies if the graph should allow in-place editing for cell labels. This implementation updates cellsEditable.

    Parameters

    • value: boolean

      Boolean indicating if the graph should allow in-place editing.

    Returns void

setCellsLocked

  • setCellsLocked(value: boolean): void
  • Sets if any cell may be moved, sized, bended, disconnected, edited or selected.

    Parameters

    • value: boolean

      Boolean that defines the new value for cellsLocked.

    Returns void

setCellsMovable

  • setCellsMovable(value: boolean): void
  • Specifies if the graph should allow moving of cells. This implementation updates {@link cellsMsovable}.

    Parameters

    • value: boolean

      Boolean indicating if the graph should allow moving of cells.

    Returns void

setCellsResizable

  • setCellsResizable(value: boolean): void
  • Specifies if the graph should allow resizing of cells. This implementation updates cellsResizable.

    Parameters

    • value: boolean

      Boolean indicating if the graph should allow resizing of cells.

    Returns void

setCellsSelectable

  • setCellsSelectable(value: boolean): void

setCloneInvalidEdges

  • setCloneInvalidEdges(value: boolean): void
  • Specifies if edges should be inserted when cloned but not valid wrt. getEdgeValidationError. If false such edges will be silently ignored.

    Parameters

    • value: boolean

      Boolean indicating if cloned invalid edges should be inserted into the graph or ignored.

    Returns void

setConnectable

  • setConnectable(connectable: boolean): void

setConnectableEdges

  • setConnectableEdges(value: boolean): void
  • Specifies if edges should be connectable.

    Parameters

    • value: boolean

      Boolean indicating if edges should be connectable.

    Returns void

setConnectionConstraint

setConstrainChildren

  • setConstrainChildren(value: boolean): void

setConstrainRelativeChildren

  • setConstrainRelativeChildren(value: boolean): void

setDefaultParent

  • setDefaultParent(cell: mxCell): void

setDisconnectOnMove

  • setDisconnectOnMove(value: boolean): void
  • Specifies if edges should be disconnected when moved. (Note: Cloned edges are always disconnected.)

    Parameters

    • value: boolean

      Boolean indicating if edges should be disconnected when moved.

    Returns void

setDropEnabled

  • setDropEnabled(value: boolean): void
  • Specifies if the graph should allow dropping of cells onto or into other cells.

    Parameters

    • value: boolean

    Returns void

setEdgeLabelsMovable

  • setEdgeLabelsMovable(value: boolean): void

setEnabled

  • setEnabled(value: boolean): void
  • Specifies if the graph should allow any interactions. This implementation updates enabled.

    Parameters

    • value: boolean

      Boolean indicating if the graph should be enabled.

    Returns void

setEnterStopsCellEditing

  • setEnterStopsCellEditing(value: boolean): void

setEscapeEnabled

  • setEscapeEnabled(value: boolean): void

setEventSource

  • setEventSource(value: any): void

setEventsEnabled

  • setEventsEnabled(value: boolean): void

setExtendParents

  • setExtendParents(value: boolean): void

setExtendParentsOnAdd

  • setExtendParentsOnAdd(value: boolean): void

setExtendParentsOnMove

  • setExtendParentsOnMove(value: boolean): void

setGridEnabled

  • setGridEnabled(value: boolean): void
  • Specifies if the grid should be enabled.

    Parameters

    • value: boolean

      Boolean indicating if the grid should be enabled.

    Returns void

setGridSize

  • setGridSize(value: number): void

setHtmlLabels

  • setHtmlLabels(value: boolean): void

setInvokesStopCellEditing

  • setInvokesStopCellEditing(value: boolean): void

setMultigraph

  • setMultigraph(value: boolean): void
  • Specifies if the graph should allow multiple connections between the same pair of vertices.

    Parameters

    • value: boolean

      Boolean indicating if the graph allows multiple connections between the same pair of vertices.

    Returns void

setPanning

  • setPanning(enabled: boolean): void

setPortsEnabled

  • setPortsEnabled(value: boolean): void
  • Specifies if the ports should be enabled.

    Parameters

    • value: boolean

      Boolean indicating if the ports should be enabled.

    Returns void

setRecursiveResize

  • setRecursiveResize(value: boolean): void

setResizeContainer

  • setResizeContainer(value: boolean): void

setSelectionCell

  • setSelectionCell(cell: mxCell): void

setSelectionCells

  • setSelectionCells(cells: mxCell[]): void

setSelectionModel

setSplitEnabled

  • setSplitEnabled(value: boolean): void
  • Specifies if the graph should allow dropping of cells onto or into other cells.

    Parameters

    • value: boolean

    Returns void

setStylesheet

setSwimlaneNesting

  • setSwimlaneNesting(value: boolean): void
  • Specifies if swimlanes can be nested by drag and drop. This is only taken into account if dropEnabled is true.

    Parameters

    • value: boolean

      Boolean indicating if swimlanes can be nested.

    Returns void

setSwimlaneSelectionEnabled

  • setSwimlaneSelectionEnabled(value: boolean): void
  • Specifies if swimlanes should be selected if the mouse is released over their content area.

    Parameters

    • value: boolean

      Boolean indicating if swimlanes content areas should be selected when the mouse is released over them.

    Returns void

setTolerance

  • setTolerance(value: number): void

setTooltips

  • setTooltips(enabled: boolean): void

setVertexLabelsMovable

  • setVertexLabelsMovable(value: boolean): void

sizeDidChange

  • sizeDidChange(): void
  • Called when the size of the graph has changed. This implementation fires a {@link size} event after updating the clipping region of the SVG element in SVG-bases browsers.

    Returns void

snap

  • snap(value: number): number
  • Snaps the given numeric value to the grid if gridEnabled is true.

    Parameters

    • value: number

      Numeric value to be snapped to the grid.

    Returns number

snapDelta

splitEdge

  • splitEdge(edge: mxCell, cells: mxCell[], newEdge: mxCell, dx?: number, dy?: number, x?: number, y?: number, parent?: mxCell): void
  • Splits the given edge by adding the newEdge between the previous source and the given cell and reconnecting the source of the given edge to the given cell. This method fires mxEvent.SPLIT_EDGE while the transaction is in progress. Returns the new edge that was inserted.

    Parameters

    • edge: mxCell

      mxCell that represents the edge to be splitted.

    • cells: mxCell[]

      mxCell that represents the cells to insert into the edge.

    • newEdge: mxCell

      mxCell that represents the edge to be inserted.

    • Optional dx: number

      Optional integer that specifies the vector to move the cells.

    • Optional dy: number

      Optional integer that specifies the vector to move the cells.

    • Optional x: number

      Integer that specifies the x-coordinate of the drop location.

    • Optional y: number

      Integer that specifies the y-coordinate of the drop location.

    • Optional parent: mxCell

      Optional parent to insert the cell. If null the parent of the edge is used.

    Returns void

startEditing

  • startEditing(evt?: MouseEvent): void
  • Calls startEditingAtCell using the given cell or the first selection cell.

    Parameters

    • Optional evt: MouseEvent

      Optional mouse event that triggered the editing.

    Returns void

startEditingAtCell

  • startEditingAtCell(cell?: mxCell, evt?: MouseEvent): void

stopEditing

  • stopEditing(cancel: boolean): void
  • Stops the current editing and fires a {@link editingStopped} event.

    Parameters

    • cancel: boolean

      Boolean that specifies if the current editing value should be stored.

    Returns void

swapBounds

  • swapBounds(cell: mxCell, willCollapse: boolean): void
  • Swaps the alternate and the actual bounds in the geometry of the given cell invoking updateAlternateBounds before carrying out the swap.

    Parameters

    • cell: mxCell

      mxCell for which the bounds should be swapped.

    • willCollapse: boolean

      Boolean indicating if the cell is going to be collapsed.

    Returns void

tapAndHold

toggleCellStyle

  • toggleCellStyle(key: string, defaultValue?: boolean, cell?: mxCell): any
  • Toggles the boolean value for the given key in the style of the given cell and returns the new value as 0 or 1. If no cell is specified then the selection cell is used.

    Parameter:

    Parameters

    • key: string

      String representing the key for the boolean value to be toggled.

    • Optional defaultValue: boolean

      Optional boolean default value if no value is defined. Default is false.

    • Optional cell: mxCell

      Optional mxCell whose style should be modified. Default is the selection cell.

    Returns any

toggleCellStyleFlags

  • toggleCellStyleFlags(key: string, flag: number, cells?: mxCell[]): void
  • Toggles the given bit for the given key in the styles of the specified cells.

    Parameters

    • key: string

      String representing the key to toggle the flag in.

    • flag: number

      Integer that represents the bit to be toggled.

    • Optional cells: mxCell[]

      Optional array of mxCell to change the style for. Default is the selection cells.

    Returns void

toggleCellStyles

  • toggleCellStyles(key: string, defaultValue?: boolean, cells?: mxCell[]): any
  • Toggles the boolean value for the given key in the style of the given cells and returns the new value as 0 or 1. If no cells are specified, then the selection cells are used. For example, this can be used to toggle mxConstants.STYLE_ROUNDED or any other style with a boolean value.

    Parameter:

    Parameters

    • key: string

      String representing the key for the boolean value to be toggled.

    • Optional defaultValue: boolean

      Optional boolean default value if no value is defined. Default is false.

    • Optional cells: mxCell[]

      Optional array of mxCell whose styles should be modified. Default is the selection cells.

    Returns any

toggleCells

  • toggleCells(show: boolean, cells: mxCell[], includeEdges: boolean): mxCell[]
  • Sets the visible state of the specified cells and all connected edges if includeEdges is true. The change is carried out using cellsToggled. This method fires mxEvent.TOGGLE_CELLS while the transaction is in progress. Returns the cells whose visible state was changed.

    Parameters

    • show: boolean

      Boolean that specifies the visible state to be assigned.

    • cells: mxCell[]

      Array of mxCell whose visible state should be changed. If null is specified then the selection cells are used.

    • includeEdges: boolean

      Optional boolean indicating if the visible state of all connected edges should be changed as well. Default is true.

    Returns mxCell[]

translateCell

  • translateCell(cell: mxCell, dx: number, dy: number): void
  • Translates the geometry of the given cell and stores the new, translated geometry in the model as an atomic change.

    Parameters

    • cell: mxCell
    • dx: number
    • dy: number

    Returns void

traverse

  • traverse(vertex: mxCell, directed: boolean, func: Function, edge?: mxCell, visited?: mxDictionary<boolean>, inverse?: boolean): void
  • Traverses the (directed) graph invoking the given function for each visited vertex and edge. The function is invoked with the current vertex and the incoming edge as a parameter. This implementation makes sure each vertex is only visited once. The function may return false if the traversal should stop at the given vertex.

    example
    mxLog.show();
    var cell = graph.getSelectionCell();
    graph.traverse(cell, false, function(vertex, edge)
    {
      mxLog.debug(graph.getLabel(vertex));
    });
    

    Parameters

    • vertex: mxCell

      mxCell that represents the vertex where the traversal starts.

    • directed: boolean

      Optional boolean indicating if edges should only be traversed from source to target. Default is true.

    • func: Function

      Visitor function that takes the current vertex and the incoming edge as arguments. The traversal stops if the function returns false.

    • Optional edge: mxCell

      Optional mxCell that represents the incoming edge. This is null for the first step of the traversal.

    • Optional visited: mxDictionary<boolean>

      Optional mxDictionary from cells to true for the visited cells.

    • Optional inverse: boolean

      Optional boolean to traverse in inverse direction. Default is false. This is ignored if directed is false.

    Returns void

ungroupCells

  • Ungroups the given cells by moving the children the children to their parents parent and removing the empty groups. Returns the children that have been removed from the groups.

    Parameters

    • cells: mxCell[]

      Array of cells to be ungrouped. If null is specified then the selection cells are used.

    Returns mxCell[]

updateAlternateBounds

  • updateAlternateBounds(cell: mxCell, geo: mxGeometry, willCollapse: boolean): void
  • Updates or sets the alternate bounds in the given geometry for the given cell depending on whether the cell is going to be collapsed. If no alternate bounds are defined in the geometry and collapseToPreferredSize is true, then the preferred size is used for the alternate bounds. The top, left corner is always kept at the same location.

    Parameters

    • cell: mxCell

      mxCell for which the geometry is being udpated.

    • geo: mxGeometry
    • willCollapse: boolean

      Boolean indicating if the cell is going to be collapsed.

    Returns void

updateCellSize

  • updateCellSize(cell: mxCell, ignoreChildren?: boolean): mxCell

updateGroupBounds

  • updateGroupBounds(cells: mxCell[], border?: number, moveGroup?: boolean, topBorder?: number, rightBorder?: number, bottomBorder?: number, leftBorder?: number): mxCell[]
  • Updates the bounds of the given groups to include all children and returns the passed-in cells. Call this with the groups in parent to child order, top-most group first, the cells are processed in reverse order and cells with no children are ignored.

    Parameters

    • cells: mxCell[]

      The groups whose bounds should be updated. If this is null, then the selection cells are used.

    • Optional border: number

      Optional border to be added in the group. Default is 0.

    • Optional moveGroup: boolean

      Optional boolean that allows the group to be moved. Default is false.

    • Optional topBorder: number

      Optional top border to be added in the group. Default is 0.

    • Optional rightBorder: number

      Optional top border to be added in the group. Default is 0.

    • Optional bottomBorder: number

      Optional top border to be added in the group. Default is 0.

    • Optional leftBorder: number

      Optional top border to be added in the group. Default is 0.

    Returns mxCell[]

updateMouseEvent

updatePageBreaks

  • updatePageBreaks(visible: boolean, width: number, height: number): void
  • Invokes from sizeDidChange to redraw the page breaks.

    Parameters

    • visible: boolean

      Boolean that specifies if page breaks should be shown.

    • width: number

      Specifies the width of the container in pixels.

    • height: number

      Specifies the height of the container in pixels.

    Returns void

updateSelection

  • updateSelection(): void
  • Removes selection cells that are not in the model from the selection.

    Returns void

validateCell

  • validateCell(cell: mxCell, context: any): null | string
  • Hook method for subclassers to return an error message for the given cell and validation context. This implementation returns null. Any HTML breaks will be converted to linefeeds in the calling method.

    Parameters

    • cell: mxCell

      mxCell that represents the cell to validate.

    • context: any

      Object that represents the global validation state.

    Returns null | string

validateEdge

  • Hook method for subclassers to return an error message for the given edge and terminals. This implementation returns null.

    Parameters

    Returns null | string

validateGraph

  • validateGraph(cell: mxCell, context: any): null | string
  • Validates the graph by validating each descendant of the given cell or the root of the model. Context is an object that contains the validation state for the complete validation run. The validation errors are attached to their cells using setCellWarning. Returns null in the case of successful validation or an array of strings (warnings) in the case of failed validations.

    Paramters:

    Parameters

    • cell: mxCell

      Optional mxCell to start the validation recursion. Default is the graph root.

    • context: any

      Object that represents the global validation state.

    Returns null | string

validationAlert

  • validationAlert(message: string): void
  • Displays the given validation error in a dialog. This implementation uses mxUtils.alert.

    Parameters

    • message: string

    Returns void

zoom

  • zoom(factor: number, center: boolean): void
  • Zooms the graph using the given factor. Center is an optional boolean argument that keeps the graph scrolled to the center. If the center argument is omitted, then centerZoom will be used as its value.

    Parameters

    • factor: number
    • center: boolean

    Returns void

zoomActual

  • zoomActual(): void

zoomIn

  • zoomIn(): void

zoomOut

  • zoomOut(): void

zoomTo

  • zoomTo(scale: number, center?: boolean): void
  • Zooms the graph to the given scale with an optional boolean center argument, which is passd to zoom.

    Parameters

    • scale: number
    • Optional center: boolean

    Returns void

zoomToRect

  • Zooms the graph to the specified rectangle. If the rectangle does not have same aspect ratio as the display container, it is increased in the smaller relative dimension only until the aspect match. The original rectangle is centralised within this expanded one.

    Note that the input rectangular must be un-scaled and un-translated.

    Parameters

    • rect: mxRectangle

      The un-scaled and un-translated rectangluar region that should be just visible after the operation

    Returns void

Generated using TypeDoc