mxGraph JavaScript
Installation
The examples can be edited with any texteditor. To run the examples point
your browser directly to the local files (use links below) or use a
webserver to deliver the files. Note that the files should always be
delivered via a webserver in production. Local usage of files is only
recommended for development and testing. (Please read this
for running examples from the local filesystem in Internet Explorer.)
Examples
javascript/examples/editors contains the following examples:
- Graph Editor -
Fully functional diagram editor and drawing application.
- mxDraw -
Web 2.0-style diagram editor and drawing application.
- mxProcess -
Process editor with a fancy stylesheet and user interface.
- mxWorkflow -
BPMN workflow editor with various example diagrams.
- mxWorkflow/Layout -
BPMN workflow editor with automatic layout.(Experimental)
javascript/examples contains the following examples:
- Codec - Dynamically creating a graph from XML and encoding the model into XML, as well
as changing the default style for edges in-place.
- Dynamicloading - Loading graph model data dynamically to limit the number of cells in the model.
- Dynamic Style - Changing the style of a cell by overriding mxGraphModel.
- Dynamic Toolbar - Changing the state of the toolbar at runtime.
- Editing - Using the in-place editor trigger to specify the editing value and write the
new value into a specific field of the user object. Wrapping and DOM nodes as
labels are also demonstrated here.
- Events - Creating a graph container and using the mxDivResizer to update the size,
interaction on the graph, including marquee selection, custom
tooltips, context menu handling and changing the default menu
opacity. It also demonstrates how to use an edgestyle in the
default stylesheet, and handle the doubleclick on the adjustment
point. See also: overlays.html for click event handling.
- File I/O - Reading an XML file, writing a custom parser, applying an automatic layout
and defining a 2-way edge.
- Graphlayout - Using automatic graph layouts and listening to changes of the graph size
to keep the container size in sync.
- Hello, World! - Using a DOM node to create a graph and adding vertices and edges.
- Hierarchical Layout - Using the hierarchical and organic layout algorithms.
- Images - Using background images and images for for the label- and image-shape.
- Indicators - Using small subshapes (indicators) inside a parent shape, typically an mxLabel.
- Label Position - Using the label position styles to set the position of vertex labels.
- Labels - Wrapping and clipping for HTML labels of vertices, truncating labels to fit the
size of a vertex, and manually placing vertex labels and relative children
that act as "sublabels".
- Layers - Using multiple layers to contain cells.
- Merge - Using the mergeChildren function to merge two graphs.
- Monitor - Using mxGraph to display the current state of a workflow.
- Offpage Connectors - Creating offpage connectors in a graph and loading a new diagram on a
single click.
- Orgchart - Using automatic layouts, fit to page zoom and poster print (across
multiple pages).
- Overlays - Cell highlighting, overlays and handling click and double click
events. See also: events.html for more event handling.
- Permissions - Creating permissions to define the available operations on a graph.
- Ports - Implementing ports as child vertices with relative positions,
drag and drop and using images and HTML in cells.
- Schema - Implementing a database schema editor.
- Scrollbars - Using a scrollable table with different sections in a cell label.
- Secondlabel - Adding another string label to vertices.
- Shape - How to implement and use a custom shape.
- Stylesheet - Using a custom stylesheet and control points in edges, as well as
overriding the getLabel and getTooltip function to return
dynamic information, and making a supercall in JavaScript.
- Swimlanes - Using swimlanes for pools and lanes and using the stack layout as an
automatic layout.
- Thread - Setting overlays in mxGraph from within a timed function.
- Toolbar - Using existing cells as templates for creating new cells.
- Tree - Folding for subtrees in acyclic graphs (trees).
- UIConfig - Using a config file to configure the toolbar and popup menu in mxEditor.
- Userobject - Using XML objects as values for cells.
- Validation - Using multiplicities for automatically validating a graph.
- Windows - Using the mxWindow class for displaying windows.
- Wrapping - Using HTML markup and word-wrapping in vertex and edge labels.
- HelloPort - Using the isPort hook for visually connecting to another cell.
- Pagebreaks - Using the pageBreaksVisible and preferPageSize switches.
- FixedPoints - Using fixed connection points for connecting edges to vertices.
- ServerView - Using a server-side image of the graph as the diagram in the client.
- ContextIcons - Adding icons to selected vertices to carry out special operations.
- Guides - Using the guidesEnabled and snapToTerminals switches, creating a grid using a canvas and handling cursor keys.
- FixedIcon - Customizing the icon position in the mxLabel shape.
- Markers - Creating custom marker.
- Dragsource - Using one drag source for multiple graphs and changing the drag icon.
- Orthogonal - Demonstrates the use of port constraints and orthogonal edge styles and handlers.
- Standardsmode - How to use mxGraphs VML rendering with a Doctype in IE.
- EdgeTolerance - Increasing the tolerance for hit detection on edges.
- Stencils - Using an XML file to define new stencils to be used as shapes.
- IE9SVG - Using SVG for rendering a diagram in IE9 (and the HTML5 doctype).
- HoverIcons - Showing icons on vertices as mouse hovers over them.
- Portrefs - Referencing connection points by ID.
- Control - Adding controls to specific cells in a graph.
- Wires - Drawing electrical and digital circuits with devices and wires.
- Menustyle - Styling the built-in popupmenu using CSS.
- Perimeter - How to avoid edge and label intersections.
- Grid - Drawing a grid dynamically using HTML 5 canvas.
- Groups - Using cells as parts of other cells.
- Visibility - Various solutions for hiding and showing cells.
- Autolayout - Running and animating a layout algorithm after every change to a graph.
- Touch - Handling touch, mouse and msPointerEvents.
- Collapse - Changing the style of a cell based on its collapsed state.
- Folding - Using a layout to implement a nested group structure.
- LOD - Implementing a level of detail per cell.
- Hoverstyle - Change the style of a vertex on mouseover.
- Anchors - Define fixed connection points for all shapes.
- Showregion - Using a custom
rubberband handler to show the selected region in a new window.
- Boundary - Implementing boundary events in BPMN diagrams.
- Map - Implementing an overlay for Google Maps.
- JQuery - Using a JQuery plugin to generate labels for vertices on the fly.
- Morph - Using mxMorphing for simple cell animations.
- HTML label - Using HTML labels that are connected to the state of the user object.
- Drop - Handling native drag and drop of images (requires modern browser).
- Handles - Using mxHandle to change custom styles interactively.
- Extend canvas - Implementing an infinite canvas with scrollbars.
- Clipboard - Using the clipboard for providing cross-tab and cross-browser copy and paste.
© 2006-2015 by JGraph Ltd.