# MindFusionDoc Documentation Map This is a unified documentation resource optimized for LLMs. The high-level guides, architectural overviews, and tutorials are inlined directly below in Section 1. All class references are merged into single files per class/struct and linked in Section 2. # Section 1: High-Level Guides and Overviews ## Untitled Topic -1 ## Introduction MindFusion.Diagramming for JavaScript (JsDiagram for short) is a flow diagramming class library that can be used to display and edit graphs and diagrams on a web page. It is implemented entirely in JavaScript and renders graphics objects using the HTML 5 Canvas element. JsDiagram is written in modern JavaScript as a set of ES6 modules, and transpiled to also provide support for CommonJS, UMD and ES5. For Canvas support and heavy-duty geometric and layout calculations done in JavaScript, JsDiagram requires latest-generation browsers. JsDiagram can give graphical representation to:  - Workflow processes - Class relationships - Graphs and networks - Entity-relationship / database diagrams - IVR systems - Industrial automation processes - Genealogy trees - Algorithms and flowcharts - Organizational charts - Classification hierarchies - And much more The library provides intuitive user-interaction model for creating or editing diagrams. In addition, its programmatic interface places at your disposal many useful functions, ranging from event handling and JSON serialization to link-routing and automatic layout algorithms. The control has been tested with the most popular modern browsers on desktop and mobile systems, and is used by companies from all around the world to create applications for various web-development platforms. ## General Information ### The JsDiagram Component - Includes ES6, CommonJs and UMD modules - Redistribution is royalty free - Can be purchased with source code - Is written in JavaScript - Draws via the HTML5 Canvas element ### User Interaction - Several user interaction modes - Scrolling and zooming - Copy and paste support - Panning - Automatic scrolling while dragging items with the mouse - Magnification - Alignment to grid - Multiple selection - Tool-tips - Docking points can be defined for nodes - Undo / redo support - Links can auto-snap to nearest node ### Programming - Model / view architecture - Programmatic access to the diagram elements - Rich event set - Numerous properties for customizing appearance and behavior - Numerous utility methods - Builder classes for fluent API ### Diagram Elements - More than 100 predefined node shapes - Rotation of shapes at arbitrary angles - Container nodes - Tables with unlimited number of rows and columns - Table cells can span several columns and rows - Display SVG drawings in nodes - Links can comprise multiple segments - Link segments can be straight lines or curves - Display multiple labels per link - Support for custom node and link types - Video nodes - Display hierarchical data in TreeView nodes - Host HTML contents in nodes ### Automatic Layout - Layered graph layout - Spring-Embedder graph layout - Fractal tree layout - Directional tree layout - Radial tree layout - Topological ordering layout - Flowchart layout - Orthogonal graph layout - Automatic link routing ### Appearance - Nodes can display images and text - Z-order - Multiple text labels per item - Various text alignment styles - Glass visual effects - Customizable fonts and colors - Custom painting of nodes - Shadows - Transparent nodes - Invisible nodes - A background swimlane grid ### Behavior - Lock diagram elements - Read-only mode supported - Tables can be scrolled - Collapse and expand hierarchy branches - In-place text editing - Dynamic positioning of links relative to connected nodes ### Link Diagram Items - Nodes to nodes - Table rows to table rows - Nodes to table rows - Unconnected links ### Auxiliary Controls - Overview control - NodeListView control - Ruler control - ZoomControl control ### Import and Export - Export Scalable Vector Graphics (SVG) files - Printing and print preview ### Front-end integration - React component - Vue.js component - Angular component ## Getting Started This guide provides a step-by-step walkthrough of setting up and using the diagram library. It is divided into five main parts. 1. (#loading-the-library) Learn the different ways to include the diagramming library in your project. This section covers loading via simple                            
                This page requires a browser that supports HTML 5 Canvas element.            
    ``` ### Loading ES6 modules via importmap Diagram's ES6 modules conform to modern JavaScript module definition that supports native import and export statements. You could import these modules directly, without using any additional module/package libraries or tools, by defining your script file as a module via ``` In order to make the diagram's ES6 modules available for importing, add the following importmap, referencing the scripts, contained in distribution's /esm folder. The purpose of the importmap is to define a map of module names which allow using import specifiers such as import {x} from "@mindfusion/diagramming" (instead of a relative path to the corresponding script file), both internally and in in your code. ``` ``` Now you can consume the modules you need by importing them into your app.js: ```javascript import * as Diagramming from '@mindfusion/diagramming'; import * as Drawing from '@mindfusion/drawing'; var diagramView = Diagramming.DiagramView.create(     document.getElementById("diagram"), diagram); ``` As of late 2024, importmap is now supported by all major modern browsers, including Chrome, Firefox, Edge, and Safari. For compatibility with older browsers, you can still use a polyfill like the https://github.com/guybedford/es-module-shims library.You can always check the latest support details at https://caniuse.com/import-maps. ### Loading npm packages and bundling There are six npm packages that provide the functionality of MindFusion.Diagramming, each containing the corresponding module. To use JsDiagram in a project, you only need to install the @mindfusion/diagramming package, the rest will be automatically added as dependencies: npm install @mindfusion/diagramming Each of the packages contains three distributions - ES module, CommonJs module and UMD, that you can use depending on your project setup. To consume a module as a CommonJS module, use the 'require' statement. The CommonJs version of the module will be loaded from the /dist/cjs folder, as specified in the package.json's main field. ```javascript const Diagramming = require('@mindfusion/diagramming'); const { DiagramView } = require('@mindfusion/diagramming'); ``` To consume a module as an ES6 module, use the 'import' statement. The ES6 version of the module will be loaded from the /dist/esm folder, as specified in the package.json's module field. ```javascript import * as Diagramming from '@mindfusion/diagramming'; import { DiagramView, Diagram } from '@mindfusion/diagramming'; ``` A sample webpack bundle configuration is shown in Samples\MinApp\TypeScript\WebPack folder of distribution: ```javascript ... "dependencies": {     "@mindfusion/diagramming":"^4.8.2" }, ... ``` ## Adding HTML Elements Now that the library is loaded, you need to add the diagram component to your HTML page. There are two primary ways to do this: 1.  The classic element: This is a straightforward approach where you manually add an HTML element to your page, wrapped inside a
that handles scrolling. It's great for simple projects or when you want explicit control over the core HTML structure. 2.  The Web Components method: This is a more modern, encapsulated approach. You use custom HTML tags (e.g. ) and the library handles the internal setup for you. This is ideal for complex UIs or if you are building your application using a component-based architecture. We will cover both methods below. ### HTML elements The (Markdown/T_MindFusion_Diagramming_DiagramView.md) control relies on the HTML5 Canvas element to render graphics on web page. If you need to display large diagrams, place the Canvas inside a Div element. Overflow and scrolling will be handled internally by (Markdown/T_MindFusion_Diagramming_DiagramView.md). ```
            This page requires a browser that supports HTML5 Canvas element.    
``` To create an instance of the (Markdown/T_MindFusion_Diagramming_DiagramView.md) class, call its static (Markdown/T_MindFusion_Diagramming_DiagramView.md#create) method, passing the DOM canvas object as argument: ```javascript var diagramView = DiagramView.create(     document.getElementById("diagram")); ``` The MindFusion.Diagramming toolkit includes additional user interface controls such as (Markdown/T_MindFusion_Diagramming_Ruler_0.md), (Markdown/T_MindFusion_Diagramming_Overview.md), (Markdown/T_MindFusion_Diagramming_NodeListView.md) and (Markdown/T_MindFusion_Controls_ZoomControl.md). If you'd like to use any of them, you will need to add Div and/or Canvas element for each one; for an example, see the Controls sample project. ### Web components Call (Markdown/T_MindFusion_Diagramming_WebComponents.md#register) to register each control class from the Diagramming package as a web component. After registration, you can use the following tags to create corresponding components: - creates a (Markdown/T_MindFusion_Diagramming_DiagramView.md) instance. - creates a (Markdown/T_MindFusion_Diagramming_Ruler_0.md) instance. - creates a (Markdown/T_MindFusion_Controls_ZoomControl.md) instance. - creates an (Markdown/T_MindFusion_Diagramming_Overview.md) instance. - creates a (Markdown/T_MindFusion_Diagramming_NodeListView.md) instance. When instantiated as a web component, each control class creates required HTML elements as internal shadow DOM. You can get the JavaScript object corresponding to a web component by calling controls' (Markdown/T_MindFusion_Diagramming_DiagramView.md#find) method with id argument. ``` ``` ```javascript var diagramView = DiagramView.find("diagramView"); var diagram = diagramView.diagram; ``` This method is demonstrated in the WebComponents.html example from the library's distribution, where you can find a complete, runnable example. ## Working with the JavaScript Diagram Model With the library loaded and a view established on your page, you can now start working with the core JavaScript objects that define your diagram's structure and content. This section introduces the two most important classes: - (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md): The data model that contains all your nodes, links, and their relationships. - (Markdown/T_MindFusion_Diagramming_DiagramView.md): The visual component that renders the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) model onto the canvas and handles user interactions. You will learn how to create a diagram instance and populate it with items, both programmatically and through direct user interaction. ### Creating and displaying a Diagram The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) is a model class, while rendering and interactions are handled by the (Markdown/T_MindFusion_Diagramming_DiagramView.md) control. The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) instance can be created first and passed to the view as a second argument of the (Markdown/T_MindFusion_Diagramming_DiagramView.md#create) method, or if not provided, an empty (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) will be created and will be accessible through the view's (Markdown/T_MindFusion_Diagramming_DiagramView.md#diagram) property. ```javascript var diagram = new Diagramming.Diagram(); var diagramView = Diagramming.DiagramView.create(     document.getElementById("diagram"), diagram); var diagramView = Diagramming.DiagramView.create(     document.getElementById("diagram")); var diagram = diagramView.diagram; ``` ### Add items from code You can create diagram items programmatically by calling methods of the diagram's (Markdown/CC_T_MindFusion_Diagramming_Factory_0.md) object. Alternatively, create an instance of any class derived from (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md) by calling its constructor, and call (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#additem) to add it to the diagram: ```javascript var node1 = diagram.factory.createShapeNode(0, 0, 10, 10); var node2 = new Diagramming.ShapeNode(diagram); node2.bounds = new Drawing.Rect(20, 0, 10, 10); diagram.addItem(node2); ``` ### Draw items interactively The (Markdown/T_MindFusion_Diagramming_DiagramView.md) can respond in various way to user input depending on the value of its (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) property. By default, it creates a (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) when the user starts drawing from unoccupied location, or a (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) when the mouse pointer is over a node. See the (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md) enumeration for other supported modes. ### Further reading Browse the topics under (#programming-interface-overview) for conceptual information. See the (#tutorials) and check the sample scripts provided with JsDiagram.zip distribution for sample source code. For integrating the diagram with popular front-end libraries and frameworks, see (#react), (#vuejs) and (#angular) topics. ## TypeScript and Code Completion ### TypeScript support A d.ts declaration file is available for every package. For more information on declaration files see https://www.typescriptlang.org/docs/handbook/2/type-declarations.html#dts-files. ### Set up code completion The library provides code completion and hints through d.ts declaration files, supported by most popular IDEs. In order to enable the feature, you need to add a commented reference to the TypeScript *.d.ts files that are included in the library distribution. The most commonly used API members are in the diagramming file, but we advise that you add references to the auxiliary files as well: ```javascript /// /// /// /// /// ``` Once the references are loaded, you should be able to see code suggestions for the applicable members together with their type. All members should be visible: methods, properties, classes etc. The distribution also includes JsDiagram-vsdoc.js file providing IntelliSense documentation in VSDoc format. If your programming environment supports it, you could add a reference to that file instead of d.ts ones: ```javascript /// ``` ## Starter Projects Here are some starter projects you can clone from GitHub to get up and running quickly with different frameworks and environments. Each project provides a basic, pre-configured setup to demonstrate the integration of the diagramming library. Vanilla JavaScript: A basic project for using the library with plain JavaScript, without any frameworks. https://github.com/MindFusionComponents/diagram-starter-vanilla NPM and a Bundler: Demonstrates how to install the library from npm and integrate it into a project that uses a module bundler (here we use Vite). https://github.com/MindFusionComponents/diagram-starter-npm Electron: A starter project for building cross-platform desktop applications. https://github.com/MindFusionComponents/diagram-starter-electron React: A starter for integrating the diagram library with the React framework. https://github.com/MindFusionComponents/diagram-starter-react React with Vite: A specific starter for React projects that use the Vite build tool. https://github.com/MindFusionComponents/diagram-starter-react-vite Angular: A starter for integrating the diagram library with the Angular framework. https://github.com/MindFusionComponents/diagram-starter-angular Vue.js: A starter for integrating the diagram library with the Vue.js framework. https://github.com/MindFusionComponents/diagram-starter-vue Socket.IO and Express server: This example instantiates (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) model on server side. https://github.com/MindFusionComponents/collaborative-mindmap-javascript ## Moving to version 4 To port a project that uses an earlier version of JsDiagram to v.4.0, follow these steps: - For projects that use module loaders, rather than accessing the MindFusion namespace from the global namespace, check the various "Loading ... modules" sections in (#getting-started) guide. - For TypeScript projects that access MindFusion namespace from the global namespace, add a reference to the global.d.ts file. - diagramming.compat.d.ts contains the module augmentation for the diagramming module and enables using legacy get/set functions in your TypeScript code. Use it with a reference path as below, or otherwise moving it to the project's main folder may be necessary. ``` /// ``` - The DOM control is now represented by the (Markdown/T_MindFusion_Diagramming_DiagramView.md) class, rather than the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) class, and you will need to replace any Diagram.create, Diagram.find, MindFusion.AbstractionLayer.createControl calls with respective (Markdown/T_MindFusion_Diagramming_DiagramView.md#create) and (Markdown/T_MindFusion_Diagramming_DiagramView.md#find) calls. The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) model object can be created first and passed to the view as a second argument of the (Markdown/T_MindFusion_Diagramming_DiagramView.md#create) method, or if not provided, an empty (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) will be created and will be accessible through the view's (Markdown/T_MindFusion_Diagramming_DiagramView.md#diagram) property. For TypeScript projects, a cast to will be necessary for the first argument. - Most getProperty/setProperty functions have been replaced by getter/setter properties. In addition, some properties and methods of the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) class related to clipboard operations, zoom and scroll, inplace-edit and recording have been moved to the (Markdown/T_MindFusion_Diagramming_DiagramView.md) class. Check the complete list of the moved properties and methods in version 4 API changes section and replace the calling instance, e.g. ```javascript // remove diagram.setBehavior(MindFusion.Diagramming.LinkTables); // add diagramView.behavior = MindFusion.Diagramming.LinkTables; ``` You can continue using legacy get/set functions for properties defined in versions up to v.4.0 in your code by setting the (Markdown/T_MindFusion_Diagramming_CompatConfig.md#propfunctions) field of (Markdown/T_MindFusion_Diagramming_CompatConfig.md) class to true. ```javascript MindFusion.Diagramming.CompatConfig.propFunctions = true; ``` If using that with TypeScript projects, also add a reference to @mindfusion/diagramming/diagramming.compat.d.ts. - Auxiliary controls, such as (Markdown/T_MindFusion_Diagramming_Overview.md), (Markdown/T_MindFusion_Controls_ZoomControl.md) and (Markdown/T_MindFusion_Diagramming_Ruler_0.md), must be attached to a (Markdown/T_MindFusion_Diagramming_DiagramView.md) instance instead of (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md). ```javascript // remove overview.setDiagram(diagram); ruler.setDiagram(diagram); zoomControl.setTarget(diagram); // add overview.diagramView = diagramView; ruler.diagramView = diagramView; zoomControl.target = diagramView; ``` - The MindFusion.AbstractionLayer class has been removed. Custom node classes in ES6 projects should be created following the ES6 class pattern, e.g. ```javascript var TemplatedBase = Diagramming.CompositeNode.classFromTemplate("TemplatedBase", ... export class OrgChartNode extends TemplatedBase {     _cost: string;     constructor(parent) {         super(parent);     };     getCost() {         return this._cost;     }     setCost(value) {         this._cost = value;     }     toJson() {        var json = super.toJson();        json.cost = this._cost;        return json;     } } ``` - Custom node classes in ES5 projects should be created following the prototypal inheritance pattern, with the account for the removal of AbstractionLayer class, e.g. ```javascript var TemplatedBase = CompositeNode.classFromTemplate("TemplatedBase", ... function OrgChartNode(parent) {     var _this = TemplatedBase.call(this, parent);     _this.cost = "low";     return _this; }; OrgChartNode.prototype.getCost = function () {     return this.cost; }; OrgChartNode.prototype.setCost = function (value) {     this.cost = value; }; OrgChartNode.prototype.toJson = function () {     var json = TemplatedBase.prototype.toJson.call(this);     json.cost = this.cost;     return json; }; ``` - Registering a custom node type with the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) now also includes serialization identifiers and version: ```javascript // remove AbstractionLayer.registerClass(OrgChartNode, "OrgChartNode", TemplatedBase); // add Diagram.registerClass(OrgChartNode, "OrgChartNode", "OrgChartNode", 1, TemplatedBase); ``` ## User Interaction Most likely an application would use JsDiagram to let users interactively create diagrams, flowcharts and other kinds of presentation documents. A user composes or edits a diagram by drawing its elements on the JsDiagram canvas area. With the help of a mouse or another pointing device users draw shapes, tables and links, possibly connecting them in complex hierarchies, graphs, trees or other structures they might need. ## Creating New Items New items can be created by drawing them with the mouse. While a user drags the mouse, the view of the control is updated to show what the new item would look like at the pointer location. If the operation cannot be completed at the current mouse position, the cursor changes to a crossed out circle. When the user releases the button, the item is created. By default links can be drawn only between nodes, unless the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#allowunconnectedlinks) property is enabled. Users can cancel item creation by pressing the right mouse button while drawing. An alternative method for users to create new nodes is drag-and-drop from the (Markdown/T_MindFusion_Diagramming_NodeListView.md) control. Nodes in the (Markdown/T_MindFusion_Diagramming_NodeListView.md) are used as prototypes and are cloned when dropped on the diagram canvas. ## Modifying Items A user modifies an item by dragging its adjustment handles. The (Markdown/T_MindFusion_Diagramming_DiagramView.md#modificationstart) property specifies when these handles appear. The first option, (Markdown/T_MindFusion_Diagramming_ModificationStart_0.md), makes the handles appear when the mouse hovers over an item; modification of the item can start immediately by pointing it and dragging a handle. The second option is (Markdown/T_MindFusion_Diagramming_ModificationStart_0.md): in order to be modified, an item should first be selected. Adjustment handles appear around the item to indicate that now it can be moved or resized. Number and functionality of those handles depend on the item type and the value of the corresponding (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#handlesstyle) property. ## Modifying a Node By default nodes display nine adjustment handles. The one at the center can be used to move the node. When dragged, each corner handle resizes the node by moving the two edges adjacent to the corresponding corner. The edge handles placed at the center of each side can be used to resize a node either horizontally or vertically. Shape nodes can be rotated using an additional round handle drawn above them. Each handle can be enabled or disabled by setting or clearing the respective bit in (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#enabledhandles). ## Modifying a Link Variety and behavior of link adjustment handles depend on the link's (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#shape) and (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#segmentcount). Control-points stay at both ends of each segment that constitutes a link. MindFusion.Diagramming for JavaScript offers several link styles. Following sections discuss how to modify links of each style. - The first style called (Markdown/T_MindFusion_Diagramming_LinkShape.md) defines links, which consist of a series of straight segments, drawn between control-points. There are no restrictions as to the number of segments. Dragging a control-point modifies each segment adjacent to the point. If the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#allowsplitlinks) property is enabled, users are allowed to insert new control points or to remove existing ones. Inserting a control point is done by pressing the left mouse button over a segment and dragging. The new point appears at the mouse location and splits the pointed segment in two. - If link's shape is set to (Markdown/T_MindFusion_Diagramming_LinkShape.md), each segment has 4 manipulation handles that define a curve. Each curve goes through the end-points, which are shaped as circles. Bend of the curve is defined by the middle two points shaped as rectangles. If a user drags an end-point modification handle, the adjacent control points will be moved with same translation vector as that of the end-point. If a bend control point is dragged, the symmetric control point of the neighboring curve is also moved to ensure the two stay on the same line with the end-point and on the same distance from it. - (Markdown/T_MindFusion_Diagramming_LinkShape.md) links consist of straight horizontal and vertical segments, each one orthogonal to its neighbors. If a control-point is dragged, the segments adjacent to it are moved and resized preserving their orthogonal orientation to each other. If the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#allowsplitlinks) property is enabled, users are allowed to insert new control points to (Markdown/T_MindFusion_Diagramming_LinkShape.md) links or remove existing ones. In that mode, users can also change orientation of end segments by dragging next-to-last control point diagonally. ## Selecting Items Multiple items are selected by dragging while CTRL key is down. Selection can also be toggled with CTRL + clicking an item. A rectangle appears around selected items, allowing a user to move all of them at once. ## Interpreting Users Actions Mouse operations can be interpreted in different ways depending on the value of the (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) property. It defines whether for example dragging the mouse creates a node or selects existing items. Check the property description for more information. ## Programming Interface Overview The Scripts/esm folder from distribution contains ES6 code that lets you import JsDiagram classes from respective modules, which are also available as scoped @mindfusion/diagramming package on npm. There are also ES5-compatible scripts located in Scripts/umd folder, which are transpiled from ES6 code, and whose classes are exposed as members of global MindFusion namespace object. The (#reference) section of this help file lists the classes under namespaces (i.e. ES5 compatible hierarchy) whose names you can easily translate to scoped module names when coding for ES6. E.g. if a class is listed under MindFusion.Graphs namespace, you can import it from respective @mindfusion/graphs package. ## Model-View Architecture JsDiagram implements the Model-View-Controller (MVC) architectural pattern starting from version 4. The MVC design pattern as applied to MindFusion.Diagramming separates the diagram data (model) from its representation to the user (view) and controlling it by the user (controller). ## Single Diagram Canvas The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) class represents the diagram data model and provides operations to process the data. It exposes properties and methods for adding new diagram elements, finding and accessing existing elements, or removing them. The (Markdown/T_MindFusion_Diagramming_DiagramView.md) class presents the relevant data from the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) class by drawing on the screen using the CanvasRenderingContext2D API. When the diagram changes, the view automatically redraws the affected part of the image to reflect the changes. Multiple views can display the same diagram, set by their (Markdown/T_MindFusion_Diagramming_DiagramView.md#diagram) property. Each view can have a different zoom level and scroll position. The (Markdown/T_MindFusion_Diagramming_DiagramView.md) class creates (Markdown/T_MindFusion_Diagramming_SinglePointerController.md) objects when user starts interacting with the diagram, depending on the value of view's (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) property. That property specifies how GUI actions to manipulate the data should be interpreted. ## Multiple Diagram Pages The (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md) class represents a collection of diagram pages or sheets, represented by (Markdown/T_MindFusion_Diagramming_DiagramPage_1.md) objects. New pages can be added to the document and existing pages can be removed and reordered by using the (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md#addpage) and (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md#removepage) methods respectively. The (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md#tojson), (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md#savetoxml) and (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md#savetostring) methods of (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md) save all pages in a single file, and respectively the (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md#fromjson), (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md#loadfromxml) and (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md#loadfromstring) methods load all pages from the file. (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md) can also load files created by the serialization methods of (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md), and will show them in a single page. (Markdown/T_MindFusion_Diagramming_DiagramPage_1.md) is derived from (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) and only adds a few properties, so any code that processes (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) objects will work with (Markdown/T_MindFusion_Diagramming_DiagramPage_1.md) objects too. A diagram document forwards each event raised by its pages, giving you a chance to use the same handler for events raised by different pages. If a page should implement distinct user interaction or validation logic, it is also possible to attach handlers to the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) events inherited by (Markdown/T_MindFusion_Diagramming_DiagramPage_1.md). A single (Markdown/T_MindFusion_Diagramming_DiagramPage_1.md) could be assigned to the (Markdown/T_MindFusion_Diagramming_DiagramView.md#diagram) property of (Markdown/T_MindFusion_Diagramming_DiagramView.md), and that lets you create your own user interface for presenting a list of pages to the user and selecting a current page. The package also includes a (Markdown/T_MindFusion_Diagramming_Controls_TabbedDiagramView.md) that presents all pages of a document in a tabbed user interface where each tab corresponds to a page. The page displayed in the active tab is exposed by the (Markdown/T_MindFusion_Diagramming_Controls_TabbedDiagramView.md#selectedpage) property of (Markdown/T_MindFusion_Diagramming_Controls_TabbedDiagramView.md). The active page can be changed interactively by activating its associated tab. New pages can be added and removed to / from the document through buttons in the tab strip and the pages can be rearranged by dragging their associated tabs with the mouse. ## User Interface Components The following UI components from the library can be added to a page to let users create and view diagrams: ### DiagramView (Markdown/T_MindFusion_Diagramming_DiagramView.md) renders the contents of a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md), and lets users draw new items by drawing with mouse or touch on the canvas. The (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) property indicates how the control should interpret users' actions. Additional properties allow scrolling and zooming the view. ### TabbedDiagramView (Markdown/T_MindFusion_Diagramming_Controls_TabbedDiagramView.md) displays multi-page (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md)s. Each (Markdown/T_MindFusion_Diagramming_DiagramPage_1.md) is displayed in its own tab. Apart from base (Markdown/T_MindFusion_Diagramming_DiagramView.md) members, the control includes properties for customizing the tab strip, and to specify whether users are allowed add or remove pages. ### Palette The (Markdown/T_MindFusion_Diagramming_Controls_Palette.md) control represents a tool palette that displays (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md) objects grouped into categories, and is implemented as accordion UI. Call the (Markdown/T_MindFusion_Diagramming_Controls_Palette.md#addcategory) method to define a category and create its respective accordion pane (an (Markdown/T_MindFusion_Diagramming_ItemListView.md)). Call (Markdown/T_MindFusion_Diagramming_Controls_Palette.md#additem) to add an item to specified category. (Markdown/T_MindFusion_Diagramming_Controls_Palette.md) provides same layout and appearance properties as the (Markdown/T_MindFusion_Diagramming_ItemListView.md) class. ### ItemListView (Markdown/T_MindFusion_Diagramming_ItemListView.md) represents a tool palette that contains uncategorized list of diagram items. Items can be added to the list by calling (Markdown/T_MindFusion_Diagramming_ListViewBase.md#additem) method, and removed by calling (Markdown/T_MindFusion_Diagramming_ListViewBase.md#removeitem). Drag-and-drop operations from (Markdown/T_MindFusion_Diagramming_ItemListView.md) to (Markdown/T_MindFusion_Diagramming_DiagramView.md) create a copy of the dragged item, and set its size to (Markdown/T_MindFusion_Diagramming_ListViewBase.md#newinstancesize). ### Overview (Markdown/T_MindFusion_Diagramming_Overview.md) provides a scaled-down view of a target (Markdown/T_MindFusion_Diagramming_DiagramView.md), helping users work with larger diagrams. A tracker rectangle shows current viewport of the main (Markdown/T_MindFusion_Diagramming_DiagramView.md), and by dragging it users can change the scroll position. It can also be resized to zoom the target view. ### ZoomControl (Markdown/T_MindFusion_Controls_ZoomControl.md) lets users change the zoom level of a target (Markdown/T_MindFusion_Diagramming_DiagramView.md) by dragging a slider. It also includes arrow buttons for scrolling the view. ### Ruler The (Markdown/T_MindFusion_Diagramming_Ruler_0.md) control displays horizontal and vertical scales that let users measure and align diagram nodes. ### ShapeDesigner (Markdown/T_MindFusion_Diagramming_Controls_ShapeDesigner.md) control lets users define shape geometries. Shape definitions can be saved as a shape library XML file, loaded by application using the (Markdown/T_MindFusion_Diagramming_ShapeLibrary_0.md) class, and accessed by calling (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md#fromid) method by the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) class. ## Diagram Structure ## Standard Item Types Diagram elements in MindFusion.Diagramming for JavaScript are represented by (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md) and (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) instances. Combined and linked together, they can form complex data structures such as process or entity-relationship diagrams, class hierarchies, networks and graphs. Each of their rich features can be customized through numerous methods and properties. ## Shape Nodes (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) objects can represent geometric shapes, flowchart elements, icons in network diagrams, and so on. They can display both graphics and text in different fonts, sizes and colors. A node's shape is specified by setting its (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#shape) property. There are more than 100 predefined node shapes and apart from them, MindFusion.Diagramming for JavaScript offers an easy way to define custom shapes. Shape nodes can be rotated, either interactively using the round selection handle drawn above them, or programmatically by setting their (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#rotationangle) property. ## SVG Nodes The (Markdown/T_MindFusion_Diagramming_SvgNode_0.md) class represents nodes that can display SVG drawings. SVG graphics are rendered instead of (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#image), and on top of the geometry rendered by the base (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) class. Enable the (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#transparent) property to hide the node's geometry and leave only the drawing visible. The SVG file is loaded and associated with the node through an (Markdown/T_MindFusion_Diagramming_SvgContent.md) object, which should be initialized and then assigned to the (Markdown/T_MindFusion_Diagramming_SvgNode_0.md#content) property. ## Composite Nodes Nodes in MindFusion.Diagramming can be composed from components. Components are graphical widgets similar to controls, which can be arranged in hierarchies and added to a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) through instances of the (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) class. The component system contains various built-in components, such as (Markdown/T_MindFusion_Drawing_Text.md) and (Markdown/T_MindFusion_Drawing_Image.md). Component hierarchies can be defined and loaded through Json templates using (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md#loadtemplate) and (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md#classfromtemplate) methods.## Table Nodes A (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md) displays tabular data, and can be used to represent table schemas in database diagrams or classes in class-hierarchies. A table contains cells arranged in a grid, and every cell can display (Markdown/T_MindFusion_Diagramming_Cell.md#text) and/or (Markdown/T_MindFusion_Diagramming_Cell.md#image). Cells, columns and rows can be customized in various ways - there are properties available for setting their extents, style, image and text alignment. Tables' dimensions can be programmatically changed; inserting, appending or deleting rows and columns can be done in a very comprehensive, intuitive way whenever you might need it. Tables can also display background images and graphics. ## Free-form Nodes A (Markdown/T_MindFusion_Diagramming_FreeFormNode_0.md) collects all points from users' mouse or touch input and displays them as node's outline. To let users draw free-form nodes interactively, set (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) to (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md). Use the (Markdown/T_MindFusion_Diagramming_FreeFormNode_0.md#points) property of (Markdown/T_MindFusion_Diagramming_FreeFormNode_0.md) to get or set outline points programmatically. If the (Markdown/T_MindFusion_Diagramming_FreeFormNode_0.md#closed) property is enabled, the node is drawn as a closed shape and its interior filled, or otherwise the node is drawn as a poly-line. If the distance between first and last points drawn by user is shorter than (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#autoclosedistance), the node gets closed automatically. ## Container Nodes A (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md) can contain other diagram nodes. When a container is moved, its child nodes move too. Containers can be nested within each other to unlimited depth. They can be folded to a smaller size, hiding their child items, and unfolded to show content again. Nodes inside a container can be linked to nodes both inside and outside of it. If a link connects items in the same container, the container is not considered an obstacle by the auto-routing algorithm. ## Paged Containers (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md) is a (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md) subclass that organizes its child nodes into a collection of (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md#pages), represented by (Markdown/T_MindFusion_Diagramming_ContainerPage.md) objects. This allows for the creation of more orgainzed diagrams where nodes can be grouped into logical views within a single container. Only the nodes belonging to the currently active page, specified by (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md#currentpage) property, are rendered and participate in user interactions.## TreeView nodes The (Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md) class represents nodes that can display hierarchical data. The root items displayed in the node can be accessed through the (Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md#rootitems) property. Items can be added and removed individually by using the (Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md#additem) and (Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md#removeitem) methods, or in bulk by calling the (Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md#fromobject) method, which loads the tree view items from an array of objects. ## Video Nodes (Markdown/T_MindFusion_Diagramming_VideoNode.md) objects display video streams, along with UI elements to play, pause, seek and change volume. Set node's (Markdown/T_MindFusion_Diagramming_VideoNode.md#videolocation) property to specify its video URL. Auto-playing is not supported at this time, and the video can be started only by users clicking the play button. (Markdown/T_MindFusion_Diagramming_VideoNode.md) is built around (Markdown/T_MindFusion_Drawing_Video.md) component, which can also be used in (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) templates. ## Control Nodes (Markdown/T_MindFusion_Diagramming_ControlNode_0.md) objects display custom HTML content, specified via their (Markdown/T_MindFusion_Diagramming_ControlNode_0.md#template) property. A node's DOM structure is created inside the (Markdown/T_MindFusion_Diagramming_ControlNode_0.md#getcontent) div element, which is then rendered on top of the diagram canvas. Note that this prevents (Markdown/T_MindFusion_Diagramming_ControlNode_0.md)s drawing in diagram' usual Z order, and they will always appear on top of other diagram items. By default the diagram intercepts mouse events of all hosted html elements to enable moving nodes or drawing links. You can specify that interactive elements, such as buttons or text boxes, should receive input instead by setting their data-interactive attribute to true. ## Links (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) objects are used to represent various types of connections and relations in diagrams. MindFusion.Diagramming for JavaScript offers three basic link shapes, which can be assigned to links' (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#shape) property: - polyline links composed of straight-line segments; - curved links composed of Bézier-spline segments; - cascading links composed of horizontal and vertical segments, alternating their orientation so that every segment is orthogonal to its neighbor. A link can be connected to a node at each of the link's ends. It is also possible to have unconnected links - having one or both of their ends  not connected to nodes. Some customizable link's properties are: arrowheads, style, text, pen width and style, modification behavior and number of segments. See Also (#controlling-user-interaction) ## Composite Nodes The (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) class makes it easier to add custom graphics primitives to nodes. Appearance of composite nodes is defined by a tree of layout panels and child components. Unlike MindFusion's desktop diagram libraries, node templates are specified using JSON notation instead of XML. A sample node class derived from (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) can be defined declaratively as below. ```javascript var OrgChartNode = CompositeNode.classFromTemplate("OrgChartNode", {  component: "GridPanel",  rowDefinitions: ["*"],  columnDefinitions: ["22", "*"],  children:  [   {    component: "Rect",    name: "Background",    pen: "black",    brush: "white",    columnSpan: 2   },   {    component: "Image",    name: "Image",    autoProperty: true,    location: "icon4.png",    margin: "1",    imageAlign: "Fit"   },   {    component: "StackPanel",    orientation: "Vertical",    gridColumn: 1,    margin: "1",    verticalAlignment: "Near",    children:    [     {      component: "Text",      name: "Title",      autoProperty: true,      text: "title",      font: "Arial bold"     },     {      component: "Text",      name: "FullName",      autoProperty: true,      text: "full name",      pen: "blue",      padding: "1,0,1,0"     },     {      component: "Text",      name: "Details",      autoProperty: true,      text: "details",      font: "Arial 3"     }    ]   }  ] }); ``` Objects from the (#mindfusiondrawing) namespace, such as (Markdown/T_MindFusion_Drawing_Rect.md), (Markdown/T_MindFusion_Drawing_Image.md), (Markdown/T_MindFusion_Drawing_Path.md), (Markdown/T_MindFusion_Drawing_Video.md), double as (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) components. You can create custom components by deriving from (Markdown/T_MindFusion_Drawing_ComponentBase.md) and assigning a name to the custom class by calling (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#registercomponent). Apart from JSON templates, the visual tree can also be created by adding panels and drawing objects programmatically starting from CompositeNode.root. Panel classes include: - (Markdown/T_MindFusion_Diagramming_SimplePanel.md), laying out its children to overlap each other, taking up all available space (useful for background graphics or images). - (Markdown/T_MindFusion_Diagramming_StackPanel.md), laying out its children side by side, either horizontally or vertically. - (Markdown/T_MindFusion_Diagramming_GridPanel.md), laying out its children in rows and columns, where children in same cell overlap. Rows and columns can be either set to a fixed size, auto-size to their child preferred size, or take up all space remaining unoccupied by other rows and columns. Named components (with specified name value) can be accessed by calling the (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md#getcomponent) method. Components whose autoProperty attribute is enabled will have a pair of get/set property methods generated automatically by (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md#classfromtemplate) method. The auto-properties from above template can be used as below. ```javascript var node1 = new OrgChartNode(diagram); node1.setBounds(new Rect(25, 15, 60, 25)); node1.setTitle("CEO"); node1.setFullName("John Smith"); node1.setDetails(     "Our beloved leader. \r\n" +     "The CEO of this great corporation."); node1.setImage("ceo.png"); diagram.addItem(node1); ``` Auto properties are also automatically serialized in JSON format, cloned by node.clone() method and saved/restored by undo commands. The (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) class used to specify (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) geometry can also be used as a component. When its isOutline attribute is set, the shape will control (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md)'s geometry too, defining hit test and clip area, and link alignment points along node's border. If isOutline is disabled, the shape will serve mostly as a decorative element. The code below shows a sample fragment specifying shape component in template: ```javascript {     component: "Shape",     id: "Cloud",     autoProperty: true,     name: "OutlineShape",     pen: "gray",     brush: "Transparent",     isOutline: true }, ``` A (Markdown/T_MindFusion_Diagramming_Button.md) component that raises event when clicked can be added to template like this: ```javascript {     component: "Button",     brush: "#ccc",     text: "Delete",     width: 30,     cornerRadius: 3.5,     clickHandler: "onDeleteClick" } ``` ## Creating and Deleting Items New items can be added programmatically to the diagram by calling the constructors of the item's class, such as (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#shapenode) or (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#diagramlink), and adding the new instance via the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#additem) method. A shortcut to creating new items is provided by the methods of the (Markdown/CC_T_MindFusion_Diagramming_Factory_0.md) class. An instance of that class is returned by the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#factory) property of (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md). Factory methods such as (Markdown/CC_T_MindFusion_Diagramming_Factory_0.md#createshapenode) and (Markdown/CC_T_MindFusion_Diagramming_Factory_0.md#creatediagramlink) accept respectively node position or link's origin and destination arguments, create an instance of the class and add it to the diagram. The (Markdown/CC_T_MindFusion_Diagramming_Factory_0.md) class can create instances of JsDiagram predefined item types, while (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#additem) can be used to add instances of custom types as well. ```javascript var ShapeNode = MindFusion.Diagramming.ShapeNode; var Rect = MindFusion.Drawing.Rect; function initDiagram(diagram) {     // create the start node     var startNode = diagram.factory.createShapeNode(10, 10, 30, 20);     startNode.text = "start";     // create the end node     var endNode = new ShapeNode(diagram);     endNode.bounds = new Rect(10, 60, 30, 20);     endNode.text = "end";     diagram.addItem(endNode);     // connect the nodes     diagram.factory.createDiagramLink(startNode, endNode); } ``` If an existing item should be removed from the diagram, call the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#removeitem) method. The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#clearall) method clears diagram contents by deleting all items. By default, deleting a node also removes its links. Set the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#autodeletelinks) property to false to prevent that, and disconnect the links instead. ## Accessing Items Items in the diagram are exposed via its (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#nodes) and (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#links) members. (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#nodes) contains all (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md) -derived objects that have been added to the diagram, and (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#links) contains all (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) objects. By iterating these arrays, you can access all diagram elements and apply common attributes to them: ```javascript // paint all nodes with light blue color for (var node of diagram.nodes) {     node.brush = "lightBlue"; } // set the links' arrowheads to triangles for (var link of diagram.links) {     link.headShape = "Triangle"; } ``` Individual items provide methods that let you access their related items in the diagram. (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md) exposes the links coming into or going out of nodes via the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#incominglinks) and (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#outgoinglinks) properties. The nodes connected by a link can be accessed by means of the (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#origin) and (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#destination) properties of (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md). The component lets users select multiple diagram items of interest. The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#selection) method of (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) returns a (Markdown/CC_T_MindFusion_Diagramming_Selection_0.md) instance representing currently selected items. The (Markdown/CC_T_MindFusion_Diagramming_Selection_0.md) class provides (Markdown/CC_T_MindFusion_Diagramming_Selection_0.md#nodes) and (Markdown/CC_T_MindFusion_Diagramming_Selection_0.md#links) arrays containing respectively (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md) and (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) -derived objects. ## Collapsing and Expanding Tree Branches If a diagram represents a tree structure, the tree branch starting from a node can be collapsed or expanded again in order to hide or display hierarchy details. To enable this, set the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#expandable) property. To get or set whether a tree branch is expanded or collapsed, use the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#expanded) property of its root node. ## Displaying Expand/Collapse Button If the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#expandable) property of a node is set to true, there is a [±] button displayed beside the node to allow users to collapse or expand the tree branch starting there. By default, pressing that button automatically toggles the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#expanded) property of the node and raises the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#treeexpanded) or (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#treecollapsed) events. ## Defining Tree Direction A node can be connected to other nodes through outgoing and incoming links. Setting the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#expandonincoming) property specifies which items connected to a node will be regarded as its descendants. If (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#expandonincoming) is false (default value) then each node will be regarded as a parent of its outgoing links and the items attached to them. If (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#expandonincoming) is set to true, the node's incoming links define its children. So, this property specifies the direction of parent-children relationship between diagram items and respectively the overall direction in which collapsing / expanding is done. ## Attaching and Grouping Items MindFusion.Diagramming for JavaScript allows attaching a node to another node, establishing a subordinate - master relationship between them. The easiest way to attach nodes is to call the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#attachto) method. When a master node is moved, its subordinated nodes follow it, so that the initial distance between the nodes stays constant. This happens both when a user moves the master node around, and when the node position is changed using a method or a property. Recent versions of the API include (Markdown/T_MindFusion_Diagramming_NodeLabel.md) and (Markdown/T_MindFusion_Diagramming_LinkLabel_0.md) classes, which address several of the scenarios described below. We recommend using these classes when appropriate, as they offer a more lightweight and easily configurable alternative to attached nodes. ## Possible Uses - Attach a (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#transparent) shape node to another node and set its (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#text), so that the shape node acts as an additional label assigned to the master node. - Attach a shape node to another node and set its (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#image), so it acts as an additional icon displayed inside or near the master node. - Attach a node to another node and handle (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodeclicked) or similar events to perform some action on the master node. This makes the subordinated node act as a button or another type of UI element attached to the master node. - Attach child elements in a tree branch to the branch root, so that when a user moves a tree node, the node's children moves simultaneously with it. Modifying an item in such hierarchical group makes the modification pervade through all dependant subordinated items. - In all previous scenarios, the (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#locked) property can be set for attached nodes which are used only as decorations embellishing the main item. That prevents users from selecting, modifying or drawing links to the subordinate nodes. ## Hierarchical Grouping Every node in a group can be the master node of another group, that is, a node can be subordinate in one group and meanwhile be another group's master. MindFusion.Diagramming for JavaScript doesn't impose any limits to the depth and width of group hierarchies built that way. However, it is not possible to put a node as a subordinate in more than one groups because the hierarchy relations would become ambiguous. ## Unions It is possible to create such groups, that if any item in the hierarchy is modified, all other items are updated too. This can be done by putting the items in circular chain of dependencies - that is, item1 is attached to item2, item2 to item3 ... itemN to item1. If any of these items is modified, the change will propagate through the chain until it reaches its originator. ## Accessing Group Items The master node in a group can be accessed using the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#masternode) property of attached nodes. The array returned by (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#attachednodes) getter on a master node contains references to all subordinate nodes attached to it. ## User Interaction ## Diagram Events The diagram raises various events to notify you of the effects of user actions, such as (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodecreated), (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodemodified), (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodedeleted), etc. Events are represented by the (Markdown/T_MindFusion_Controls_EventDispatcher.md) class and are accessible as properties of the corresponding objects ((Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#diagrambase-events) or (Markdown/T_MindFusion_Diagramming_DiagramView.md#diagramview-events)). Event listeners are attached through the (Markdown/T_MindFusion_Controls_EventDispatcher.md#addeventlistener) method and removed through the (Markdown/T_MindFusion_Controls_EventDispatcher.md#removeeventlistener) method. The following sample code attaches an event listener to the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodecreated) event of a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) control. The variable diagram identifies a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) instance and onNodeCreated is the name of the event handler function: ```javascript diagram.nodeCreated.addEventListener(onNodeCreated); ``` All event handlers receive two arguments. The first 'sender' argument specifies the object that emits the event, and the second 'args' argument is an instance of an (Markdown/T_MindFusion_Controls_EventArgs.md) -derived class: ```javascript function onNodeCreated(sender, args) {     // ... } ``` While some events are raised to notify you that the user has performed an action, like the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodecreated) event, validation events let you accept or reject user actions before actually changing the diagram. Validation event names usually end in '-ing' suffix, such as (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodecreating). The args parameter passed to their handler functions is an instance of a (Markdown/T_MindFusion_Controls_CancelEventArgs.md) -derived class. Validation event handlers are expected to set the value of args' (Markdown/T_MindFusion_Controls_CancelEventArgs.md#cancel) property either to true if it should be rejected or false (the default) if it should be accepted. The following code handles the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodedeleting) event and, if the node to be deleted is a (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md) instance, cancels the action: ```javascript diagram.nodeDeleting.addEventListener(     (sender, args) =>     {         args.cancel = args.node instanceof TableNode;     }); ``` ## Controlling User Interaction There are several ways to control user actions on the diagram as a whole, or on individual items in the diagram. ## Drawing Modes The (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) property of (Markdown/T_MindFusion_Diagramming_DiagramView.md) provides several predefined sets of rules specifying how to interpret user input through pointing device. The default (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) is (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md), where drawing with mouse or touch from an unoccupied point of the document is processed as a (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) creation request, and drawing from a node creates a (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md). Additional members of the (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md) enumeration provide modes for drawing different node types, and ones that allow only limited interactions, such as (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md) or (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md). ## Item Constraints Constraints upon how users are allowed to modify a node are set through the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#constraints) and (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#enabledhandles) properties. The former can be used to constrain the move direction, node size and aspect ratio. The latter enables or disables specific manipulation handles of a node. That allows making the node non-moveable, non-resizable, or resizable only horizontally/vertically. Items can be locked by setting their (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#locked) property. Locked items are excluded from selection and users cannot select, move or modify them. ## In-place Text Editing The text of nodes and links can be edited in-place by double-clicking the respective items. To enable this feature, set the (Markdown/T_MindFusion_Diagramming_DiagramView.md#allowinplaceedit) property to true. Depending on the type of item, the control raises either the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodetextedited), (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#celltextedited) or (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#linktextedited) event when its text has been edited. In-place editing mode is exited when users click outside the text entry control. Pressing ENTER or ESC exits inplace-edit mode if respectively (Markdown/T_MindFusion_Diagramming_DiagramView.md#inplaceeditacceptonenter) and (Markdown/T_MindFusion_Diagramming_DiagramView.md#inplaceeditcancelonesc) are enabled. By default, the control creates a textarea DOM element over an item to allow editing the item's text. If you prefer using a different type of element as in-place editor, handle the (Markdown/T_MindFusion_Diagramming_DiagramView.md#createeditcontrol) event and set the (Markdown/T_MindFusion_Diagramming_InplaceEditEventArgs.md#control) property of the provided (Markdown/T_MindFusion_Diagramming_InplaceEditEventArgs.md) object. ## Validation Events While the user draws new nodes or links, the control raises the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodecreating) or (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#linkcreating) events after each change of the mouse position. By setting the (Markdown/T_MindFusion_Controls_CancelEventArgs.md#cancel) property of the event object, you can prevent the operation from being completed at the current position but let the user continue drawing. Calling the (Markdown/T_MindFusion_Diagramming_ItemEventArgs_1.md#canceldrag) method immediately stops the operation. The (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodemodifying) and (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#linkmodifying) events provide the same functionality during modification of existing objects. Finally, if the user tries to delete an item, you can handle the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodedeleting) or (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#linkdeleting) event to prevent this. ## Interaction Properties - (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#allowselfloops) property of (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) specifies whether users can draw reflexive / self-loop links. - (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#allowunconnectedlinks) property specifies whether users can create links without connecting them to nodes (e.g. for simple line or curve graphics in a drawing). - (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#allowlinksrepeat) specifies whether user can draw a second link between same pair of nodes. - (Markdown/T_MindFusion_Diagramming_DiagramView.md#delkeyaction) specifies how the (Markdown/T_MindFusion_Diagramming_DiagramView.md) handles the Delete key. - (Markdown/T_MindFusion_Diagramming_DiagramView.md#modifierkeyactions) allows changing the function of modifier keys. - (Markdown/T_MindFusion_Diagramming_DiagramView.md#leftbuttonactions), (Markdown/T_MindFusion_Diagramming_DiagramView.md#middlebuttonactions) and (Markdown/T_MindFusion_Diagramming_DiagramView.md#rightbuttonactions) allow mapping interaction types to mouse buttons. - (Markdown/T_MindFusion_Diagramming_DiagramView.md#mousewheelaction) allows changing the function of the mouse wheel. - (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#allowincominglinks) and (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#allowoutgoinglinks) properties of (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md) specify if a node accepts respective types of links. - setting the (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#locked) property of a (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md) prevents users from interacting with it altogether. ## Multi-touch Support The control handles DOM Pointer events to implement multi-touch interactions, such as zooming, node rotation or simultaneous drawing of multiple diagram items: - If (Markdown/T_MindFusion_Diagramming_DiagramView.md#multitouchzoom) property is enabled (default), the view can be zoomed or panned using two-touch pinch / flick gestures. - If (Markdown/T_MindFusion_Diagramming_DiagramView.md#multitouchmodify) property is enabled (default), diagram nodes can be moved, scaled and rotated using two-touch pinch / flick gestures. - If (Markdown/T_MindFusion_Diagramming_DiagramView.md#multitouchzoom) property is disabled, each touch draws diagram items corresponding to current behavior. - If (Markdown/T_MindFusion_Diagramming_DiagramView.md#multitouchmodify) property is disabled, each touch started from a node draws a diagram link. Latter modes can be used for collaborative whiteboarding / classroom scenarios. Built-in multi-touch can be disabled altogether by setting (Markdown/T_MindFusion_Diagramming_DiagramView.md#enablemultitouch) to false, e.g. if you need to handle touch events yourself or through a third-party gesture library. If disabled, the control will revert to its mouse event handling code from previous versions. It will also no longer be able to capture mouse input during drag operations (to detect mouse pointer leaving the view), which is handled through DOM Pointers API. ## User-interaction controllers All kinds of user interaction are carried out by controller objects. Built-in controllers include (Markdown/T_MindFusion_Diagramming_CreateNodeController.md), (Markdown/T_MindFusion_Diagramming_CreateLinkController.md), (Markdown/T_MindFusion_Diagramming_ModifyNodeController.md), (Markdown/T_MindFusion_Diagramming_ModifyLinkController.md), (Markdown/T_MindFusion_Diagramming_PanController.md). You can also create custom controllers by deriving and overriding the methods of (Markdown/T_MindFusion_Diagramming_SinglePointerController.md): ```javascript SinglePointerController.prototype = {     start: function (position) {},     move: function (position) {},     validate: function (position) {},     commit: function (position) {},     cancel: function (position) {},     drawInteraction: function (context) {} } ``` The controller instance used by the diagram when interaction starts is returned by (Markdown/T_MindFusion_Diagramming_BehaviorBase.md#createcontroller) method of (Markdown/T_MindFusion_Diagramming_BehaviorBase.md) -derived classes. You can replace the method of standard behavior classes with a custom function to return a different controller, or inherit a new class from (Markdown/T_MindFusion_Diagramming_BehaviorBase.md) that implements it and assign it to the currentBehavior property of (Markdown/T_MindFusion_Diagramming_DiagramView.md). ## Alignment Grid MindFusion.Diagramming provides an alignment grid to help users place the diagram items more precisely. To activate the grid, set the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#aligntogrid) property to true. If the grid is active while an item is being created or modified, the item's control-points are aligned to the nearest grid points. The distance between adjacent grid points is set by the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#gridsizex) and (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#gridsizey) properties. The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#gridoffsetx) and (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#gridoffsety) properties allow specifying the horizontal and vertical offset of the first point in the alignment grid. Items created or modified by a user are automatically aligned to the grid. However, if items are placed in the diagram programmatically, their coordinates are set to the specified positions without aligning. In such cases use the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#alignpointtogrid) method if items must be placed exactly at grid points. The grid can be either visible or invisible, depending on whether the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#showgrid) property is enabled. If visible, the grid is painted as a matrix of points or as series of crossing lines, as specified by the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#gridstyle) property. (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#gridcolor) defines the color with which the alignment points or lines are painted. ## Undo and Redo If the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#undoenabled) property is set to true, the control records users actions and allows undoing them later. The records are stored in a list, and can be undone consecutively by calling the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#undo) method. An action that has been undone can be redone by calling the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#redo) method. You can enable or disable UI elements that undo or redo commands by binding them to the canUndo and canRedo properties. The control also runs and saves in the undo history (Markdown/T_MindFusion_Diagramming_AddItemCommand.md) and (Markdown/T_MindFusion_Diagramming_RemoveItemCommand.md) commands when items are programmatically added or removed from the Items collection of the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md). No other changes are recorded automatically when done from code. If support for undo/redo of such changes is required, they must be done through the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#executecommand) method. To allow undoing changes of (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md) properties, create a (Markdown/T_MindFusion_Diagramming_ChangeItemCommand.md) instance before setting the property values, and call (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#executecommand) afterwards. Any other types of undoable changes can be implemented by deriving from the (Markdown/T_MindFusion_Diagramming_Command.md) class and overriding its (Markdown/T_MindFusion_Diagramming_Command.md#execute), (Markdown/T_MindFusion_Diagramming_Command.md#undo) and (Markdown/T_MindFusion_Diagramming_Command.md#redo) methods. ## Scrolling and Zooming The (Markdown/T_MindFusion_Diagramming_DiagramView.md) control implements scroll and zoom support. If diagram's size is larger than current (Markdown/T_MindFusion_Diagramming_DiagramView.md#viewport), scrollbars appear and let the user scroll to clipped parts of the diagram. ## Diagram Size The diagram size is set through the (Markdown/T_MindFusion_Controls_Canvas.md#bounds) property. Its value is a (Markdown/T_MindFusion_Drawing_Rect.md) instance that specifies the origin of the diagram coordinate system and the diagram size. Scrollbar ranges also depend on the current (Markdown/T_MindFusion_Diagramming_DiagramView.md#zoomfactor). ## Automatic Scrolling The (Markdown/T_MindFusion_Diagramming_DiagramView.md#autoscroll) property controls automatic scrolling. If it is enabled and the user drags an adjustment handle near the (Markdown/T_MindFusion_Diagramming_DiagramView.md) edges while manipulating an item, the control will scroll the viewport towards the mouse position. The (Markdown/T_MindFusion_Diagramming_DiagramView.md#scrollzonesize) property defines the size of the area near the view borders that triggers automatic scrolling. ## Programmatic Scrolling In order to scroll the document content programmatically, you can call the (Markdown/T_MindFusion_Diagramming_DiagramView.md#scrollto) method or set (Markdown/T_MindFusion_Diagramming_DiagramView.md#scrollx) and (Markdown/T_MindFusion_Diagramming_DiagramView.md#scrolly) properties. The latter can also be used to access the current scroll position in case you need it. The (Markdown/T_MindFusion_Diagramming_DiagramView.md#bringintoview) method scrolls the view to ensure that a specific diagram item can be seen inside the viewport. ## Zooming Zooming is controlled via the (Markdown/T_MindFusion_Diagramming_DiagramView.md#zoomfactor) property. The zoom level is expressed as a percentage, 100% meaning no zoom. Higher than 100% makes the diagram items look closer and bigger on the screen - zooming in. Less than 100% makes items look further and smaller on screen - zooming out. To zoom and scroll the view to fit the diagram contents to the control's client area, call (Markdown/T_MindFusion_Diagramming_DiagramView.md#zoomtofit). To zoom and scroll the view so it fits a specified rectangular document area to the control's client area, call (Markdown/T_MindFusion_Diagramming_DiagramView.md#zoomtorect). ## Lasso Zoom Tool The control supports several ways to zoom using lasso tool: - Set the (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) property to (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md) to always draw zoom lasso. - Set the (Markdown/T_MindFusion_Diagramming_ModifierKeyAction_0.md) flag for one of the keys in (Markdown/T_MindFusion_Diagramming_DiagramView.md#modifierkeyactions) to let users draw zoom-lasso with respective modifier key pressed and the left mouse button. - Assign (Markdown/T_MindFusion_Diagramming_MouseButtonActions_0.md) value to (Markdown/T_MindFusion_Diagramming_DiagramView.md#rightbuttonactions) or (Markdown/T_MindFusion_Diagramming_DiagramView.md#middlebuttonactions) property to zoom using respective mouse button. ## Zoom control The (Markdown/T_MindFusion_Controls_ZoomControl.md) class lets user change interactively the current zoom level and scroll position of a (Markdown/T_MindFusion_Diagramming_DiagramView.md). To set it up, add a element to the page (possibly placing it on top of (Markdown/T_MindFusion_Diagramming_DiagramView.md)'s one), call (Markdown/T_MindFusion_Controls_ZoomControl.md#create) to instantiate, and set the control's (Markdown/T_MindFusion_Controls_ZoomControl.md#target) property to that view. Set the (Markdown/T_MindFusion_Controls_ZoomControl.md#zoomstep) and (Markdown/T_MindFusion_Controls_ZoomControl.md#scrollstep) properties to specify the amount added to view's zoom level or scroll position by (Markdown/T_MindFusion_Controls_ZoomControl.md)'s buttons. You can customize the control's appearance by setting properties such as (Markdown/T_MindFusion_Controls_ZoomControl.md#fill), (Markdown/T_MindFusion_Controls_ZoomControl.md#bordercolor), (Markdown/T_MindFusion_Controls_ZoomControl.md#cornerradius) and (Markdown/T_MindFusion_Controls_ZoomControl.md#tickposition). For an example, see the Controls.html and Controls.js sample files from distribution.## Magnifying The (Markdown/T_MindFusion_Diagramming_DiagramView.md) provides an option for zooming in (or out) portions of the diagram through the Magnifier tool. The magnifier tool can be permanently activated by setting (Markdown/T_MindFusion_Diagramming_DiagramView.md#magnifierenabled) to true. Alternatively, on-demand magnification through the right mouse button or by pressing a modifier key can be enabled be setting the appropriate value to the (Markdown/T_MindFusion_Diagramming_DiagramView.md#rightbuttonactions) or (Markdown/T_MindFusion_Diagramming_DiagramView.md#modifierkeyactions) properties respectively. The magnification factor can be specified through the (Markdown/T_MindFusion_Diagramming_DiagramView.md#magnifierfactor) property. The size of the tool and its border thickness can be set through the (Markdown/T_MindFusion_Diagramming_DiagramView.md#magnifierwidth), (Markdown/T_MindFusion_Diagramming_DiagramView.md#magnifierheight) and (Markdown/T_MindFusion_Diagramming_DiagramView.md#magnifierframethickness) properties. ## Panning The diagram view can be panned by holding ALT while dragging the mouse with the left button down. Another modifier key can be used for panning by setting (Markdown/T_MindFusion_Diagramming_DiagramView.md#modifierkeyactions). The (Markdown/T_MindFusion_Diagramming_DiagramView.md#middlebuttonactions) and (Markdown/T_MindFusion_Diagramming_DiagramView.md#rightbuttonactions) properties let you use the middle or right mouse button to start panning. To let users pan the view with the left mouse button without using a modifier key, set the (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) property of (Markdown/T_MindFusion_Diagramming_DiagramView.md) to (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md) or (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md). ## Testability User interaction can be tested automatically in several ways outlined below. - Create a (Markdown/T_MindFusion_Diagramming_MouseInputDispatcher.md) instance and call its methods ```javascript onMouseDown: function (position, button) onMouseMove: function (position) onMouseUp: function (position, button) ``` where position is a (Markdown/T_MindFusion_Drawing_Point.md) instance specifying logical coordinates in the diagram (in current measure unit, not scaled by zoom factor). The results of called mouse methods will depend on diagram's current (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior), e.g. you could assert that a sequence of down, move andup events creates a (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) when (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) is set to (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md). - Create an instance of controller class and call its (Markdown/T_MindFusion_Diagramming_SinglePointerController.md#start), (Markdown/T_MindFusion_Diagramming_SinglePointerController.md#move) and (Markdown/T_MindFusion_Diagramming_SinglePointerController.md#commit) methods. This would not depend on the value of diagram's (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior), but could be still affected by other behavioral properties such as (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#allowselfloops) and (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#allowunconnectedlinks). - Check assertions after replaying a recording on a saved diagram, using (Markdown/T_MindFusion_Diagramming_DiagramView.md#record), (Markdown/T_MindFusion_Diagramming_DiagramView.md#stoprecording) and (Markdown/T_MindFusion_Diagramming_DiagramView.md#replay) methods. ## Placement and Layout ## Items Placement and Z-order ## Measure Unit The (Markdown/T_MindFusion_Controls_Canvas.md#measureunit) property specifies the unit of measure for all location and size-related values assigned to JsDiagram properties or passed as arguments to its methods.## Location and Size of Nodes Set the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#bounds) method to change the location and size of a node. Its values are (Markdown/T_MindFusion_Drawing_Rect.md) objects that contain coordinates and dimension properties. The (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#bounds) getter lets you find the current location and size of a node as set by users or layout algorithms.## Links Control Points Links must have two or more control points, depending on their (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#shape) property. You can get access to the control points via link's (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#controlpoints) collection. You must call (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#updatefrompoints) after programmatically moving control points of a link; that's needed in order to repaint the link and update its internal state variables, such as arrowhead angles.## Link Dynamics The (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#dynamic) property of a link can be enabled to make the link automatically recalculate its end point positions if the nodes connected to the link are moved or resized; the end points are moved in such a way that the link points to the centers of the connected nodes. Links also expose an (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#autoroute) property that enables or disables automatic routing for a link. Routed links avoid nodes by finding the shortest path between their (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#origin) and (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#destination) that does not cross any other nodes.## Interactive Moving or Resizing End-users of your application can move or resize the diagram elements. They do this by selecting an item and dragging any of its adjustment handles, a point inside its interior, any of its sides or a selection frame. The (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#handlesstyle) property of nodes controls how interaction can be performed. Additionally it defines the representation of selected items on screen. (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#enabledhandles) lets you disable specific manipulations users are allowed to perform on a node, for example resizing the item horizontally or moving it. If an item is modified interactively, the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#nodemodified) or (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#linkmodified) event is raised, depending on the item's type.## Controlling Z-order The Z-order defines how items are ordered along the Z-axis, so that one item appears in front of or behind another one. Diagram items are sorted by the value of their (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#zindex) property, and rendered on screen in ascending order. You can change the Z index of a (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md) by setting (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#zindex) (values don't have to be consecutive). ## Lane Grid The classes from the (#mindfusiondiagramminglanes) namespace let you develop process maps and lane diagrams, useful in business process planning and reporting. Processes consist of consecutive operations accomplished by people involved, technical installations, means of contact, and flow of information. The MindFusion.Diagramming for JavaScript lane grid features allow indicating and arranging related diagram items in complicated processes and systems, that is, Swim lane diagrams (known as Rummler-Brache diagram), Gantt Charts (planning and scheduling of projects). A lane in the grid can visually contain nodes, links, shapes or images, that represent tasks fulfilled in specified periods of time by people, companies or departments. The (#mindfusiondiagramminglanes) namespace provides the (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md), (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md), (Markdown/T_MindFusion_Diagramming_Lanes_Cell.md) and (Markdown/T_MindFusion_Diagramming_Lanes_Style_0.md) classes, and the (Markdown/T_MindFusion_Diagramming_Lanes_ResizeType_0.md) enumeration. These types expose additional properties and methods that let you define your own grids as required by your application logic. Grids can include varying number of lanes, divided into child rows and columns whose intersections form cells. The cell color and style can be customized too. Use the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#showlanegrid) property of the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) class to display lanes in your application. The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#lanegrid) lets you setup the rows and columns in the grid by defining horizontal and vertical lanes, where each lane can be titled by its own header and/or subheadings. The grid can be resized by setting the (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#columncount) and (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#rowcount) properties or by adding headers via the (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#addcolumnheader) and (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#addrowheader) methods. A column or row can be divided into child elements by adding subheaders, which lets you form a complex hierarchy of unlimited depth. The intersection of rows and columns can be either a simple cell for bottommost elements in the hierarchy, or a group of cells for parent rows and columns. Cells or cell groups can be accessed via the (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md)'s (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#get) method, that lets you index cells either by their integer positions, or by their (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md) objects. The position of the grid and grid headers within the diagram is defined via (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#topmargin) and (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#leftmargin), which specify the grid offset relative to the diagram bounds. (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#hookheaders) enables lane headers to be anchored to the left or right side of the control's visible area. The sizes of headers at different levels in the lane hierarchy can be set in a single operation by setting (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#rowheaderswidths) and (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#columnheadersheights) properties. The appearance of the lanes grid can be customized further via the (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#headersontop) poperty, which specifies whether headers should appear on top of the Z-order, and the (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#topleftareastyle) specifying the appearance of the grid's top-left corner. The (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md) class provides many miscellaneous properties and methods that can be used to find grid elements, for determining their bounds and for hit-testing: (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#findcolumn), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#findrow), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getcellbounds), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getcellcolumn), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getcellfrompoint), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getcellrow), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getcolumn), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getrow), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getrowindex), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#columnheaderbounds), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getcolumnindex), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getheaderbounds), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#rowheaderbounds), (Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md#getheaderfrompoint). Headers in the lanes grid can be customized by using the following members of the (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md) class: | **Member name ** | **Description ** | (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md#height) | Gets or sets the height of the header and the related row in the grid. | (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md#resizetype) | Gets or sets the resize type of the header. | (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md#rotatetitle) | Gets or sets a value indicating whether rotating of the header caption at 90 degree is enabled. | (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md#style) | Gets or sets the style of the header. | (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md#subheaders) | Gets a collection with the subheaders of the header. | (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md#title) | Gets or sets the header caption. | (Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md#width) | Gets or sets the width of the header and the related column in the grid. ## Anchor Points and Patterns ## Anchor Points For each node you can define one or more points to which links should dock when connecting to that node. Such points are represented by instances of the (Markdown/CC_T_MindFusion_Diagramming_AnchorPoint_0.md) class. The position of an anchor point relative to node's bounding rectangle is specified via the (Markdown/CC_T_MindFusion_Diagramming_AnchorPoint_0.md#x) and (Markdown/CC_T_MindFusion_Diagramming_AnchorPoint_0.md#y) properties. Their values are expressed as percentage of the node's width and height to accommodate for moving and resizing. You can control whether an anchor point accepts incoming or outgoing links or both. That is done via the (Markdown/CC_T_MindFusion_Diagramming_AnchorPoint_0.md#allowincoming) and (Markdown/CC_T_MindFusion_Diagramming_AnchorPoint_0.md#allowoutgoing) properties. When a link is drawn, its ends are aligned to the nearest anchors allowing docking of the respective end type. Another way to control whether links can be connected to an anchor point is to handle the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#validateanchorpoint) event. ## Anchor Patterns An (Markdown/CC_T_MindFusion_Diagramming_AnchorPattern_0.md) instance defines a set of anchor points to be used together. When creating a pattern, pass to its constructor an array of (Markdown/CC_T_MindFusion_Diagramming_AnchorPoint_0.md) objects. The (Markdown/CC_T_MindFusion_Diagramming_AnchorPattern_0.md) class exposes several predefined patterns as static properties. A pattern can be assigned as an integral entity to the (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#anchorpattern) property of nodes. Setting the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md#anchorpattern) property of a (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) object lets you define the connection points for all (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md)s of that shape. The following example creates a pattern of four anchor points: ```javascript var AnchorPattern = MindFusion.Diagramming.AnchorPattern; var AnchorPoint = MindFusion.Diagramming.AnchorPoint; var apat1 = new AnchorPattern([     new AnchorPoint(50, 0, true, true),     new AnchorPoint(100, 50, true, true),     new AnchorPoint(50, 100, true, true),     new AnchorPoint(0, 50, true, true)     ]); ``` The points are located at the middles of bounding rectangle sides of nodes to which the pattern is assigned. All four points accept both incoming and outgoing links. ## Link Routing Routed links avoid nodes marked as (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#obstacle)s by finding the shortest path between their origin and destination that does not cross any other nodes. ## Setting Up a Link Router The control finds paths for links affected by modifications of nearby nodes by calling methods of an object that implements the (Markdown/T_MindFusion_Diagramming_Router.md) interface. This object can be get or set through the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#linkrouter) property of the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) class. JsDiagram provides several classes that implement (Markdown/T_MindFusion_Diagramming_Router.md) - (Markdown/T_MindFusion_Diagramming_PatternRouter_0.md), (Markdown/T_MindFusion_Diagramming_GridRouter_1.md) and (Markdown/T_MindFusion_Diagramming_CompositeRouter_0.md). By default (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#linkrouter) is set to a (Markdown/T_MindFusion_Diagramming_CompositeRouter_0.md) instance.## Automatic or Explicit Routing The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#routealllinks) method can be invoked to explicitly rearrange links in a way they do not cross nodes. In addition, (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) defines an (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#autoroute) property that enables or disables automatic routing of a link, applied when user moves link's adjacent nodes or draws a new node in its vicinity. (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#autoroute) is initialized with the value of diagram's (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#routelinks) property.## Tuning the Routing Algorithm Router classes define properties that let you fine-tune their specific algorithms. For a reference, see specific (Markdown/T_MindFusion_Diagramming_CompositeRouter_0.md), (Markdown/T_MindFusion_Diagramming_PatternRouter_0.md) or (Markdown/T_MindFusion_Diagramming_GridRouter_1.md). ## Performance Consideration The default router is designed to produce visually optimal link paths that avoid overlapping with nodes and minimize bends. However, it is computationally intensive and can impact performance in diagrams with a large number of links or frequent layout changes. For improved performance, you could set (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#linkrouter) to a simple (Markdown/T_MindFusion_Diagramming_Router.md) instance. This will reduce CPU usage and improve responsiveness, though the resulting link paths may be less visually refined. ## Laying out the Diagram The diagram can be arranged automatically by calling its (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#arrange) method and specifying a layout algorithm. Different layout algorithms are implemented by the various (Markdown/T_MindFusion_Graphs_Layout.md) classes from the (#mindfusiongraphs) namespace. To apply one of them, create an instance of the respective class, customize its properties and pass it as an argument to (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#arrange). It is also possible to lay out the contents of an individual (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md) by calling the container's (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md#arrange) method. ## Layered Graph Layout The (Markdown/T_MindFusion_Graphs_LayeredLayout.md) algorithm arranges diagram nodes in layers according to several criteria, most important of which are: connected nodes must be placed close together; links must flow in one direction if possible; links must cross as few layers as possible; links must not cross other links. To apply the layout to a diagram, create a (Markdown/T_MindFusion_Graphs_LayeredLayout.md) instance, set its members and invoke the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#arrange) method. ## Spring-Embedder Graph Layout Spring-Embedder is force-directed layout algorithm. It simulates a physical system in which nodes repulse each other, and the links between them act as confining springs. Graphs processed by Spring-Embedder have their nodes distributed uniformly across the diagram area. The algorithm can be applied on a graph by creating a (Markdown/T_MindFusion_Graphs_SpringLayout.md) object and calling the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#arrange) method. Members of (Markdown/T_MindFusion_Graphs_SpringLayout.md) allow you to set the desired distance between graph nodes and the number of iteration steps to run while processing the simulation. ## Tree Layout If application's data is structured hierarchically, it is appropriate to apply tree layout on it. To do this, create a (Markdown/T_MindFusion_Graphs_TreeLayout.md) or (Markdown/T_MindFusion_Graphs_BorderedTreeLayout.md) instance and call the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#arrange) method. The difference between two classes is where they place child nodes in relation to their parent; the former centers the parent above its children, the latter arranges children in columns at a horizontal offset form their parent (see (#tutorial-2-loading-hierarchical-data)). Members of both classes control the tree direction, how much space to leave between tree levels and between nodes on the same level. ## Fractal Layout The (Markdown/T_MindFusion_Graphs_FractalLayout.md) tree layout algorithm places child nodes symmetrically around their parent node. Nodes at the lowest level are arranged directly in a circle around their parent. At the upper level, the already arranged nodes form branches that are arranged in a circle around the new parent node. The algorithm is recursively repeated till the highest level is reached. ## Treemap Layout Tree maps represent hierarchies by nesting child nodes within their parents, where the areas of leaf nodes are proportional to their (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#weight) values. Unlike other layout algorithms, (Markdown/T_MindFusion_Graphs_TreeMapLayout.md) expects hierarchies to be defined via grouping or containment (see (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#attachto) method and (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md) class), and will ignore any links in the diagram. ## Flowchart Layout (Markdown/T_MindFusion_Graphs_FlowchartLayout.md) recognizes program code -like patterns in the graph, such as loops, sequences and if/switch branchings, and arranges them recursively. (Markdown/T_MindFusion_Graphs_FlowchartLayout.md) could be used to arrange other types of graphs as well, though with some restrictions. For example it treats all back links as loops in the code, and expects that they are nested - loop links starting closer to the stop node should end closer to the start node. Another similar restriction is that there shouldn't be any cross-links that connect different branches of a decision sub-graph. ## Topological Layout (Markdown/T_MindFusion_Graphs_TopologicalLayout.md) applies graph topological ordering to the diagram (topological ordering of a graph is one where link's origin node is placed before link's destination node). The layout algorithm arranges nodes in a row or a column, depending on the value of the (Markdown/T_MindFusion_Graphs_TopologicalLayout.md#direction) property, in such a way that there are no backward links when the graph is acyclic. If the graph contains cycles, the algorithms selects ordering with as few backward links as possible. Links that connect non-adjacent nodes are rendered as arcs, whose amplitude is proportional to the distance between respective connected nodes. Forward links are rendered at one side of the nodes and back links are rendered at the opposite side. All that makes it easy to discern graph features such as overall flow direction, cycles and nested cycles. ## Orthogonal Layout The (Markdown/T_MindFusion_Graphs_OrthogonalLayout.md) class implements an orthogonal graph layout algorithm. Each link is drawn as a chain of alternating horizontal and vertical segments. Nodes are placed in a way that facilitates few links bends and crossings. This algorithm was designed for planar graphs where the nodes have at most four incident links, and produces best results with such graphs as input. It can arrange any arbitrary graph as well, by adding some dummy nodes and links to planarize the graph and reduce its vertex degree, and removing them after the layout. ## Radial Tree Layout The (Markdown/T_MindFusion_Graphs_RadialTreeLayout.md) class arranges tree levels in concentric circles around the root. The (Markdown/T_MindFusion_Graphs_RadialTreeLayout.md#leveldistance) property specifies the distance between adjacent circles. The (Markdown/T_MindFusion_Graphs_RadialTreeLayout.md#direction) property specifies placement of first child node. Set (Markdown/T_MindFusion_Graphs_RadialTreeLayout.md#stretchfactor) to a value larger than 1 in order to stretch level circles into ellipses, providing more space for the layout when using wider nodes. ## Grid Layout The (Markdown/T_MindFusion_Graphs_GridLayout.md) algorithm arranges diagram nodes in a grid, keeping connected nodes close to each other. The algorithm strives to achieve a small number of link crossings. It is based on an iterative process whose initial steps shuffle the grid nodes randomly. That can lead to very different results each time the algorithm is run. ## Appearance ## Customizing Node Appearance Nodes can have different shape, background image or color.  They can also have differently aligned text. ## Geometric Shapes (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) exposes a (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#shape) property that specifies the geometric shape of the node. Its value can be set to either a (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) object (returned by one of the static methods of the (Markdown/CC_T_MindFusion_Diagramming_Shapes_0.md) class), or a string id of the shape, which coincides with the name of the method that gets it. Here is an example: ```javascript myNode.shape = "Arrow1"; ``` (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md) and (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md) provide (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md#shape) properties too, but their shapes can only be set to either rectangle or rounded rectangle, as specified via (Markdown/T_MindFusion_Diagramming_SimpleShape_0.md) enumeration. ## Bitmap Images Each node can display a bitmap image as its content. The image can be set either via the (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#image) or (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#imagecontent) properties, where the former accepts DOM Image instances, and the latter accepts base64-encoded bitmaps. By default the bitmap is drawn centered inside the node. You can change the alignment by setting (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#imagealign). Images can also be loaded by URL via the (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#imagelocation) property. ## Fill Color Nodes can be painted in any color that you choose. Set the (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#brush) property to specify how a node is painted. ```javascript myNode.brush = "Red"; ``` ## Linear Gradients Nodes can be filled using linear gradients by assigning objects in following format to (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#brush). If the gradient should blend only two colors, they can be specified using color1 and color2 fields instead of colorStops. ```javascript var brush1 = {  type: "LinearGradientBrush",  colorStops:  [   { position: 0, color: "red" },   { position: 0.5, color: "green" },   { position: 1, color: "blue" }  ],  angle: 30 }; myNode.brush = brush1; ``` ## Radial Gradients Nodes can be filled using radial gradients by assigning objects in following format to (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#brush). If the gradient should blend only two colors, they can be specified using color1 and color2 fields instead of colorStops. ```javascript var brush2 = {  type: "RadialGradientBrush",  colorStops:  [   { position: 0, color: "white" },   { position: 0.5, color: "lightGray" },   { position: 1, color: "blue" }  ],  x1: 20, y1: 20, radius1: 30,  x2: 40, y2: 20, radius2: 80 }; myNode.brush = brush2; ``` ## Text and Font Nodes can display text with customizable font and horizontal/vertical alignment. Set the (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#text) property to specify the text label for a node, and (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#textcolor) to change its color. (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#textalignment) and (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#linealignment) properties let you set respectively horizontal and vertical alignment. The (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#font) property lets you specify a distinct font for each node: ```javascript var Font = MindFusion.Drawing.Font; //the bool arguments specify whether the font is bold and italic startNode.font = new Font("sans-serif", 5, true, false); ``` Apart from main text content, the (Markdown/T_MindFusion_Diagramming_NodeLabel.md) class lets you display additional labels and pin them to node's edges or corners. Call the (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#addlabel) method to create such supplementary labels, and use (Markdown/T_MindFusion_Diagramming_NodeLabel.md) (and base (Markdown/T_MindFusion_Diagramming_ItemLabel.md)) properties and methods to customize their appearance and position. The text of (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md)s can be laid out and rendered inside a polygonal outline; that depends on the value of (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#polygonaltextlayout). ## Styled Text The (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#enablestyledtext) property of shape nodes and tables enables or disables styled text rendering. Styled text can have various attributes applied to the characters it contains. The attributes are specified using HTML-like formatting tags embedded in the raw text. The following table lists the currently supported style tags: | **Tag ** | **Description ** | text | Indicates italic text. | text | Indicates bold text. | text | Indicates underlined text. | text | Indicates subscript. | text | Indicates superscript. | text | Changes the color of the text. The red, green and blue color channels are specified as two-digit hexadecimal numbers. |
| Indicates line break. | text | Renders specified text as a hyperlink and raises (Markdown/T_MindFusion_Diagramming_Events.md#hyperlinkclicked) event when link has been clicked. | text | Changes the font size. ## Node Effects To apply an effect to the nodes in a diagram, create an instance of one of the effect classes and add this instance to the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#nodeeffects) array. To apply the effect to individual nodes, add the instance to a node's own (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#effects) array. To ignore the global diagram effects for a particular node, add a null reference at position 0 in the node's (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#effects). Effects can also be applied through styles by adding them to the (Markdown/CC_T_MindFusion_Diagramming_Style_0.md#nodeeffects) array of the diagram or a node. It is possible to combine different effects by adding instances of their appropriate types to the effect collections. If is also admissible to apply more than one effect of the same type. The currently supplied effect types are Aero and Glass. They are examined in more details in the sections below. ## Aero Effect The Aero effect is represented by the (Markdown/T_MindFusion_Diagramming_AeroEffect_0.md) class. The effect is designed to roughly resemble the Aero theme of Windows. More specifically, the effect adds semi transparency to the nodes, a smooth shade at the outside and a thin inset stroke. The semi transparency is specified through the (Markdown/T_MindFusion_Diagramming_AeroEffect_0.md#opacity) property. Opacity varies from 0 to 1 inclusive, where 0 indicates full transparency and 1 indicates the original node color. The semi transparency is applied only on the node's (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#brush). The colors of the shade and the inner stroke are specified through the (Markdown/T_MindFusion_Diagramming_AeroEffect_0.md#shadecolor) and (Markdown/T_MindFusion_Diagramming_AeroEffect_0.md#inneroutlinecolor) properties respectively. The following image illustrates how these properties affect the output: The following example applies the Aero effect on the nodes of an existing diagram: ```javascript var AeroEffect = MindFusion.Diagramming.AeroEffect; var effect = new AeroEffect(); effect.opacity = 0.5; effect.innerOutlineColor = "rgba(255,255,255,0.5)"; diagram.nodeEffects.push(effect); ``` ### Tips - The Aero effect works very well in scenarios with overlapping nodes or in cases where the background is more complex than solid color, due to the effect of semi transparency. - Aero combines well with the Glass effect. There are some examples at the end of this topic. - The (Markdown/T_MindFusion_Diagramming_AeroEffect_0.md#shadecolor) is usually black or another dark color. However, some nice glow effects can be achieved by setting bright (Markdown/T_MindFusion_Diagramming_AeroEffect_0.md#shadecolor) on a diagram with dark background. - The Aero effect can impact performance if there are many nodes visible in the diagram. ## Glass Effect The Glass effect is represented by the (Markdown/T_MindFusion_Diagramming_GlassEffect_0.md) class. The Glass effect adds visuals on top of the nodes in order to give the impression of a reflective surface. There are several variations of this effect, which can be selected through the (Markdown/T_MindFusion_Diagramming_GlassEffect_0.md#type) property. The color of the reflection and the ambient color can be specified through the (Markdown/T_MindFusion_Diagramming_GlassEffect_0.md#reflectioncolor) and (Markdown/T_MindFusion_Diagramming_GlassEffect_0.md#glowcolor) properties respectively. When (Markdown/T_MindFusion_Diagramming_GlassEffect_0.md#usepenasglow) is set to true, the color of the node's pen is used as the ambient color. The following image illustrates the differences between the distinct effect types: The following example applies a Glass effect with the default settings to the nodes of a diagram: ```javascript var GlassEffect = MindFusion.Diagramming.GlassEffect; diagram.nodeEffects.push(new GlassEffect()); ``` ### Tips - The (Markdown/T_MindFusion_Diagramming_GlassEffect_0.md#glowcolor) is usually white. However, for (Markdown/T_MindFusion_Diagramming_GlassEffectType_0.md) glass effects it is often more suitable to use black glow. - The Glass effect combines well with the Aero effect. There are some examples at the end of this topic. - Several glass effects of different types can be applied simultaneously for emphasized effect. ## Examples The values of the effect properties are usually selected in accordance with the color scheme of the target diagram and the desired end result. In addition different types of effects can be applied simultaneously to achieve more interesting results. The examples below demonstrate possible effect combinations in various color contexts. ### Aero & Glass (Dark on Light) In this example the Aero and Glass effects are combined. The Aero effect is useful in scenarios when dark nodes are placed on light background or vice versa, in order to emphasize the contrast. Here is the code that applies the above effects: ```javascript diagram.nodeEffects.push(new GlassEffect()); diagram.nodeEffects.push(new AeroEffect()); ``` ### Aero & Glass (Light on Dark) This example is similar to the first one, only this time the nodes are painted in light colors and the background is dark. Here is the code that applies the above effect: ```javascript var AeroEffect = MindFusion.Diagramming.AeroEffect; var GlassEffect = MindFusion.Diagramming.GlassEffect; var GlassEffectType = MindFusion.Diagramming.GlassEffectType; var glassEffect = new GlassEffect(); glassEffect.type = GlassEffectType.Type3; diagram.nodeEffects.push(glassEffect); diagram.nodeEffects.push(new AeroEffect()); ``` ### Glow Effect This example uses bright colors on black background to create a glow effect. The example utilizes an Aero effect with (Markdown/T_MindFusion_Diagramming_AeroEffect_0.md#shadecolor) set to the color of the nodes' pens. Here is the code that applies the above effects: ```javascript var AeroEffect = MindFusion.Diagramming.AeroEffect; var GlassEffect = MindFusion.Diagramming.GlassEffect; var GlassEffectType = MindFusion.Diagramming.GlassEffectType; var glassEffect = new GlassEffect(); glassEffect.type = GlassEffectType.Type2; glassEffect.usePenAsGlow = true; diagram.nodeEffects.push(glassEffect); var aeroEffect = new AeroEffect(); aeroEffect.opacity = 0; aeroEffect.innerOutlineColor = "black"; aeroEffect.shadeColor = "rgb(128, 255, 255)"; diagram.nodeEffects.push(aeroEffect); ``` ## Customizing Link Appearance (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md)-s consist of series of straight or Bezier segments and arrowhead shapes. The link and arrowhead shapes, and also color attributes and text can be customized as detailed below: ## Link Geometry Links can be straight or curved and can contain one or more segments. Set (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#shape) to change the shape. It takes as an argument one of the (Markdown/T_MindFusion_Diagramming_LinkShape.md) enumeration values: ```javascript myLink.shape = LinkShape.Cascading; ``` The link can be customized further by changing its (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#controlpoints) array, whose elements specify the position of the link segments. The number of control points per segment depends on the link's (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#shape): (Markdown/T_MindFusion_Diagramming_LinkShape.md) links have four control points per segment. Each straight segment has two control points. Adjacent segments share a control point. The following code sets three control points of a polyline link, which results in two segments: ```javascript var Point = MindFusion.Drawing.Point; myLink.controlPoints = ; ``` Always call DiagramLink.(Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#updatefrompoints)() after you change coordinates of individual control points in the array. ## Rounded Links Links comprising straight segments (ones whose (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#shape) is set to (Markdown/T_MindFusion_Diagramming_LinkShape.md) or (Markdown/T_MindFusion_Diagramming_LinkShape.md)) can draw arcs as joints between their adjacent segments. To enable that feature, set (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#roundedlinks) to true. Use (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#roundedlinksradius) to specify the radius of the joining arcs.## Link Crossings Intersection points where links cross their paths can be rendered as arcs or cuts, as specified via (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#linkcrossings). It depends on the Z-order, which links jump over the others, or which links appear cut by the others. If (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#linkcrossings) is set to (Markdown/T_MindFusion_Diagramming_LinkCrossings_0.md), links with higher ZIndex jump over those with lower ZIndex. If set to (Markdown/T_MindFusion_Diagramming_LinkCrossings_0.md), links at lower Z position are cut by links at higher Z. Radius of arcs and breaks can be set through the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#crossingradius) property.## Customizing Arrowheads Each link can display arrowhead shapes at its ends. The shape at the start is specified via (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#baseshape) property, the shape at the end is specified via (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#headshape). Arrowheads can also be displayed at middles of segments, helping users follow the path of long links. They are defined by the (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#intermediateshape) property. Arrowhead values can be set to either a (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) instance or a string that identifies it: ```javascript myLink.headShape = "BowArrow"; ``` (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) objects designed specifically as arrowheads are exposed as static members of the (Markdown/T_MindFusion_Diagramming_ArrowHeads_1.md) class. ## Specifying Colors Link segments are rendered according to (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#stroke), (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#strokethickness) and (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#strokedashstyle) attributes. The arrowheads at the head and base are filled using (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#headbrush) and (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#basebrush) properties: ```javascript // paints the link head with red brush myLink.headBrush = "Red"; ``` ## Setting Text Set the (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#text) property to specify text label of a link, and (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#font) to customize its font. Here is an example how to do this: ```javascript myLink.text = "myLabel"; var Font = MindFusion.Drawing.Font; // the bool arguments specify whether the font is bold and italic myLink.font = new Font("sans-serif", 5, true, false); ``` The font size is specified in the diagram's current measure unit, which is millimeter by default. Apart from main text content, the (Markdown/T_MindFusion_Diagramming_LinkLabel_0.md) class lets you display additional labels and pin them to link's points or segments. Call the (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#addlabel) method to create such supplementary labels, and use (Markdown/T_MindFusion_Diagramming_LinkLabel_0.md) (and base (Markdown/T_MindFusion_Diagramming_ItemLabel.md)) properties and methods to customize their appearance and position. ## Styles and Themes Appearance of items can be customized using (Markdown/CC_T_MindFusion_Diagramming_Style_0.md) objects assigned to respective (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#style) property of (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md). The attributes from a style are applied only when item's own corresponding properties do not contain values. Style objects can also be collected into a (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md) and applied as a set to the whole diagram by assigning it to the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#theme) property. The library includes nine stock themes listed below, accessible via respective static methods of the (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md) class. | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getblue) | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getbusiness) | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getearth) | | | | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getgray) | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getgreen) | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getlight) | | | | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getpastel) | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getpeach) | (Markdown/CC_T_MindFusion_Diagramming_Theme_0.md#getstandard) | | | Creating and applying a custom theme looks like this: ```javascript var theme = new Theme(); var shapeNodeStyle = new Style(); shapeNodeStyle.brush = { type: 'LinearGradientBrush', color1: '#e0e9e9', color2: '#9caac6', angle: 90 }; shapeNodeStyle.stroke = "#7F7F7F"; shapeNodeStyle.textColor = "#585A5C"; shapeNodeStyle.fontName = "Verdana"; shapeNodeStyle.fontSize = 3; theme.styles.set("std:ShapeNode", shapeNodeStyle); var linkStyle = new Style(); linkStyle.stroke = "#7F7F7F"; linkStyle.textColor = "#585A5C"; linkStyle.fontName = "Verdana"; linkStyle.fontSize = 3; theme.styles.set("std:DiagramLink", linkStyle); var tableStyle = new Style(); tableStyle.brush = { type: 'LinearGradientBrush', color1: '#FCFCFC', color2: '#9DABB4', angle: 90 }; tableStyle.stroke = "#7F7F7F"; tableStyle.textColor = "#585A5C"; tableStyle.fontName = "Verdana"; tableStyle.fontSize = 3; theme.styles.set("std:TableNode", tableStyle); diagram.theme = theme; ``` ## CSS Styling The styling system also lets you define item appearance through external CSS files. You can style different item types using custom element selectors such as mfd-shapenode, mfd-diagramlink, or mfd-tablenode. The system maps CSS Custom Properties to the internal (Markdown/CC_T_MindFusion_Diagramming_Style_0.md) properties. For example, use --brush for backgrounds, --stroke for outlines, and --font-size for text. The new (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#cssclass) property on (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md) allows for more granular styling using standard class selectors in your CSS. To ensure high performance, computed styles are cached globally, and the system automatically resolves style inheritance across class hierarchies (e.g., a (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) will resolve styles from mfd-shapenode, mfd-diagramnode, and mfd-diagramitem selectors in that order). ```csharp /* Style all shape nodes */ mfd-shapenode {     --brush: #f9f9f9;     --stroke: #333;     --stroke-thickness: 1px;     --font-name: 'Verdana'; } /* Specific styling via the new cssClass property */ mfd-shapenode.urgent {     --brush: #ffcccc;     --stroke: #ff0000;     --stroke-thickness: 2px; } /* Style table captions using custom properties */ mfd-tablenode {     --caption-brush: #e0e0e0;     --text-color: #000066; } ``` Here is the complete list of mfd- prefixed CSS element selectors available for styling items: ## Base Elements - mfd-diagramitem: The base selector for all diagram items. Styles applied here will be inherited by all other items unless overridden. - mfd-diagramnode: The base selector for all node types. Inherits from mfd-diagramitem. ## Specific Node Types (all inherit from mfd-diagramnode) - mfd-shapenode: Styles (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) instances. - mfd-svgnode: Styles (Markdown/T_MindFusion_Diagramming_SvgNode_0.md) instances. - mfd-compositenode: Styles (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) instances. - mfd-controlnode: Styles (Markdown/T_MindFusion_Diagramming_ControlNode_0.md) instances. - mfd-videonode: Styles (Markdown/T_MindFusion_Diagramming_VideoNode.md) instances. - mfd-freeformnode: Styles (Markdown/T_MindFusion_Diagramming_FreeFormNode_0.md) instances. ## Container & Complex Nodes - mfd-containernode: Styles (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md) instances (inherits from mfd-captionednode). - mfd-captionednode: The base selector for nodes with captions like Tables and TreeViews. Inherits from mfd-diagramnode. - mfd-tablenode: Styles (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md) instances (inherits from mfd-captionednode). - mfd-treeviewnode: Styles (Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md) instances (inherits from mfd-captionednode). ## Links - mfd-diagramlink: Styles (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) instances. Inherits from mfd-diagramitem. ## Sample Inheritance Chains - mfd-shapenode ? mfd-diagramnode ? mfd-diagramitem - mfd-tablenode ? mfd-captionednode ? mfd-diagramnode ? mfd-diagramitem - mfd-diagramlink ? mfd-diagramitem ## Properties Here is the list of custom CSS properties (variables) available for diagram items. These properties should be defined within the mfd- element selectors, and possibly assigned to specific items via the (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#cssclass) property. ## Primary Appearance - --brush: Specifies the background / fill color. Supports CSS color strings (e.g., `#FF0000`, `rgba(...)`, `lightblue`). - --stroke: Specifies the outline / border color. - --stroke-thickness: Specifies the width of the outline. Supports units like px, mm, pt, or in (values are converted to diagram's (Markdown/T_MindFusion_Controls_Canvas.md#measureunit)). - --shadow-color: Specifies the color of the item's shadow. ## Typography & Text - --text-color: Specifies the color of the text label. - --font-name: Specifies the font family (e.g., 'Verdana', 'Arial'). - --font-size: Specifies the size of the font. Supports CSS units (values are converted to diagram's (Markdown/T_MindFusion_Controls_Canvas.md#measureunit)). - --font-weight: Use 'bold' to apply bold styling. - --font-style: Use 'italic' to apply italic styling. - --text-decoration: Use 'underline' to apply underline styling. ## Selection States - --selected-brush: Specifies the fill brush used when the item is selected. - --selected-stroke: Specifies the outline color used when the item is selected. ## Specialized Properties - --caption-brush: Specifies the background color of captions (used by mfd-tablenode, mfd-containernode, and mfd-treeviewnode). - --vertical-border-stroke: Specifies the color of vertical grid lines/borders (primarily for (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md)). - --horizontal-border-stroke: Specifies the color of horizontal grid lines/borders (primarily for (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md)). ## Define Shape Geometries Diagrams can display geometric shapes by setting the (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#shape) property of (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) instances. ## Shape Templates The (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) class provides the means for defining complex node shapes, made of straight lines, arcs and Bézier curves. A shape template must always contain an outline to be used for hit testing, clipping and finding intersections with other items. Optionally shapes can contain decoration elements, which are visual elements that do not take part in hit testing and clipping. JsDiagram provides a set of over a 100 (#table-of-predefined-shapes), which can be accessed by the (Markdown/CC_T_MindFusion_Diagramming_Shapes_0.md) collection or (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md#fromid) method of the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) class. A shape is assigned to a node by means of the (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#shape) property. ```javascript shapeNode.shape = MindFusion.Diagramming.Shapes.Actor(); shapeNode.shape = MindFusion.Diagramming.Shape.fromId("Actor"); ``` ## Custom Shapes You can define your own shapes by using the static (Markdown/CC_T_MindFusion_Diagramming_Factory_0.md#createshapenode) method of the Diagramming.Controls.ShapeBuilder class. The shape geometry is specified as an array of ShapeElements. The (Markdown/T_MindFusion_Diagramming_ShapeElement.md) class constructor expects a command and an array of command parameters, and optionally styling. The list of supported commands matches the HTML Canvas drawing API (e.g moveTo, lineTo, bezierCurveTo, arc, roundRect). Coordinates are defined as percentage of a node's bounding rectangle. ```javascript var outline = []; outline.push(new ShapeElement("moveTo", )); outline.push(new ShapeElement("lineTo", )); outline.push(new ShapeElement("lineTo", )); outline.push(new ShapeElement("lineTo", )); outline.push(new ShapeElement("lineTo", )); outline.push(new ShapeElement("bezierCurveTo", )); outline.push(new ShapeElement("lineTo", )); var shape = MindFusion.Diagramming.Controls.ShapeBuilder.createShape("MyShape", outline); shapeNode.shape = shape; ``` The (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) definition can also contain decorations and shape decorations. A decoration is a geometry that consists of one or more lines or curves. A shape decoration is a closed path of lines and/or curves, that can also have a fill. A shape can have one decoration and a number of shape decorations, that are specified through the decorationElements and shapeDecorationElements parameters as follows: ```javascript var decoration = []; decoration.push(new ShapeElement("moveTo", )); decoration.push(new ShapeElement("lineTo", , "red")); decoration.push(new ShapeElement("lineTo", , "blue", 4)); var shapeDecorationElements = []; shapeDecorationElements.push(new ShapeElement("roundRect", )); var shapeDecoration = new ShapeDecoration(shapeDecorationsElements, "red"); var shape = MindFusion.Diagramming.Controls.ShapeBuilder.createShape(     "MyShape", outline, decoration, ); ``` If you don't need the per-element styling options, another way to create a shape is by creating an instance of the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) class providing the outline definition using SVG Path syntax. ```javascript var shape = new Shape({     id: "MyShape"     outline: "M100,50 A50,50,0,1,1,0,50 A50,50,0,1,1,100,50",     decoration: "M98,50 A48,48,0,1,1,2,50 A48,48,0,1,1,98,50"}); ``` A string identifier must be specified for every shape so they will be accessible via the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md#fromid) method. ## Shape Libraries You can use a Shape Library xml file to store your collection of custom shapes. Set the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#shapelibrarylocation) property to specify the path to the file. ```javascript diagram.shapeLibraryLocation = "MyShapes.sl"; ``` The shapes in the Shape Library file will be automatically added to the shared list of shapes kept in the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) class, which lets you access them by calling the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md#fromid) method. ## Shape Designer Tool The ShapeDesigner tool that comes with JsDiagram lets you create and edit custom shapes interactively and save them to Shape Library files. When the tool starts, a new shape library is created by default with a single basic rectangular shape in it. To modify the shape, drag and drop shape elements from the palette to the right onto the shape canvas. The following drop operations are supported: - dropping an element over existing element of a shape outline replaces the element (the element to be replaced will be marked in red) - dropping an element over the joint of two outline elements inserts the element between them (the joint will be marked in blue) - dropping an element on an empty area of the canvas adds a decoration to the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) - dropping a decoration over the shape outline replaces all elements of the outline with ones from the decoration - dropping a decoration on an empty area of the canvas adds a filled (Markdown/T_MindFusion_Diagramming_ShapeDecoration_1.md) to the (Markdown/CC_T_MindFusion_Diagramming_Shape_0.md) - dropping a decoration over a (Markdown/T_MindFusion_Diagramming_ShapeDecoration_1.md) replaces its elements Elements/decorations can be further customized by dragging their control points. You can delete, copy and paste dropped elements/decorations, as well as undo and redo drop actions via the options in the Edit menu. Styling can be specified to elements/decorations by using the controls in the property panel, that is shown when an element/decoration is selected. The Preview panel lets you see how your shape will look and behave in a real DiagramView control.   New shapes can be added from the Shape/New menu option. The finished library can be exported to an .sl file from the File/Save Library menu option. ## Animations ## Item Animations The (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#animate) method of (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md) can run following animations: - (Markdown/T_MindFusion_Diagramming_Animations_FillColorAnimation_0.md) animates the fill color of nodes or link arrowheads. - (Markdown/T_MindFusion_Diagramming_Animations_StrokeColorAnimation_0.md) animates the color of node borders or link segments. - (Markdown/T_MindFusion_Diagramming_Animations_OpacityAnimation_0.md) animates items' opacity for fade-in and fade-out effects. The following animations can be applied to (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md)s: - (Markdown/T_MindFusion_Diagramming_Animations_BounceAnimation_0.md) animates vertical position of nodes. - (Markdown/T_MindFusion_Diagramming_Animations_ShakeAnimation_0.md) animates horizontal position of nodes. - (Markdown/T_MindFusion_Diagramming_Animations_PulseAnimation_0.md) animates node's local scale factor. - (Markdown/T_MindFusion_Diagramming_Animations_PathAnimation_0.md) moves nodes along specified path. Item's animated values are considered transient and do not change actual property values. If you want to assign last value from animation to actual property such as (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md#bounds) or (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#opacity), set the keepLastValue flag in animation parameters: ```javascript node.animate(     new PathAnimation(         [             new Point(30, 30),             new Point(50, 30),             new Point(75, 66),             new Point(125, 88)         ],         {             keepLastValue: true         })); ``` Other animation parameters include duration, repeat, repeatCount, from / to values, animation curve and easing options: ```javascript node.animate(     new OpacityAnimation(         {             fromValue: 1,             toValue: 0.5,             duration: 250,             repeat: true,             repeatCount: 4,             reverse: true,             animationType: Animations.AnimationType.BackBow         })); ``` Item and view animations that affect different properties can run simultaneously. ## View Animations The (Markdown/T_MindFusion_Diagramming_DiagramView.md#animate) method of (Markdown/T_MindFusion_Diagramming_DiagramView.md) can run following animations: - (Markdown/T_MindFusion_Diagramming_Animations_ScrollAnimation.md) animates the scroll position of a view. - (Markdown/T_MindFusion_Diagramming_Animations_ZoomAnimation.md) animates the zoom factor of a view. ```javascript diagramView.animate(         new ScrollAnimation(         {             fromValue: new Point(0, 0),             toValue: new Point(100, 60),             animationType: Animations.AnimationType.Power,             easingType: Animations.EasingType.EaseInOut         })); ``` View animations are not transient and always set the (Markdown/T_MindFusion_Diagramming_DiagramView.md#scrollx) or (Markdown/T_MindFusion_Diagramming_DiagramView.md#zoomfactor) properties. ## Looping Animations To create looping animations, use the (Markdown/T_MindFusion_Animations_Animation.md#repeat) and (Markdown/T_MindFusion_Animations_Animation.md#reverse) properties. To stop an animation, call its (Markdown/T_MindFusion_Animations_Animation.md#stop) method. ```javascript // Use this property to repeat the animation until stopped. animation.repeat = true; // Use this property to reverse the to and from values. animation.reverse = true; // Use the stop method to complete the animation. animation.stop(); ``` ## Custom Animations To animate arbitrary attributes of any type, an (Markdown/T_MindFusion_Animations_Animation.md) instance can receive an updateCallback function as a parameter to the constructor. This callback function can be used to set item coordinates or property values of the object being animated. The callback signature should contain two arguments - the animation object instance and a value representing the animated property delta. This callback is called at every animation timer "tick". The following example creates a pulse-like effect, using an update callback: ```javascript var Animation = MindFusion.Animations.Animation; var Utils = MindFusion.Diagramming.Utils; var options =     {         duration: 550,         fromValue: -0.15,         toValue: 0.15,         repeat: true,         reverse: true     }; /** * @param animation The animation object instance. * @param animationDelta A number representing the percentage of displacement  * of the animated property's value in the range. */ function pulse(animation, animationDelta) {     var bounds = animation.item.bounds.clone();     var to = animation.toValue;     bounds = Utils.inflate(bounds, to * animationDelta, to * animationDelta);     animation.item.setBounds(bounds, true); } var animation = new Animation(node, options, pulse); animation.start(); ``` Alternatively, a class derived from (Markdown/T_MindFusion_Animations_Animation.md) could override the virtual onUpdate method. ## Default Animation and Easing Functions There are seven default animation type functions that can be used to animate items, designated by respective elements of (Markdown/T_MindFusion_Animations_AnimationType.md) enumeration: - Linear: represents an animation that accelerates / decelerates using a linear function. - Power: represents an animation that accelerates / decelerates through exponentiation formula - x^n where n can be set through the animation's (Markdown/T_MindFusion_Animations_Animation.md#param) property. The default exponent value is 2. - Exponential: represents an animation that accelerates / decelerates using an exponential function. The exponent can be set through the animation's (Markdown/T_MindFusion_Animations_Animation.md#param) property. The default exponent value is 10. - Circular: represents an animation that accelerates / decelerates using a circular function. - BackBow: represents an effect that simulates a retraction in the motion of the animation. The amplitude of the retraction can be controlled through the animation's (Markdown/T_MindFusion_Animations_Animation.md#param) property. The default param value is 1.5. - Bounce: represents a bouncing effect animation. - Elastic: represents an oscillating effect animation. The oscillation frequency can be controlled through the animation's (Markdown/T_MindFusion_Animations_Animation.md#param) property. The default param value is 0.5. The default animations can be additionally customized by an easing function, specified via (Markdown/T_MindFusion_Animations_EasingType.md) enumeration: - EaseIn: follows the animation function associated with the (Markdown/T_MindFusion_Animations_Animation.md). - EaseOut: inverses the animation function associated with the (Markdown/T_MindFusion_Animations_Animation.md). - EaseInOut: uses (Markdown/T_MindFusion_Animations_EasingType.md) for the first half of the (Markdown/T_MindFusion_Animations_Animation.md)'s duration and (Markdown/T_MindFusion_Animations_EasingType.md) for the second half. - EaseOutIn: uses (Markdown/T_MindFusion_Animations_EasingType.md) for the first half of the (Markdown/T_MindFusion_Animations_Animation.md)'s duration and (Markdown/T_MindFusion_Animations_EasingType.md) for the second half. ## Custom Animation Functions In addition to the provided default animation functions, it is also possible to define custom animation effects. Set the (Markdown/T_MindFusion_Animations_Animation.md#animationtype) property to (Markdown/T_MindFusion_Animations_AnimationType.md) and pass a custom animation function callback to the (Markdown/T_MindFusion_Animations_Animation.md) constructor. The callback signature should contain two arguments - the time progressed as a percentage from the start of the animation and the user-set parameter, used in the animation function. The following example uses a custom function where x is a value between 0 and 1 and y is a parameter, passed as an argument to the (Markdown/T_MindFusion_Animations_Animation.md) constructor. ```javascript var Animation = MindFusion.Animations.Animation; var AnimationType = MindFusion.Animations.AnimationType; var options =     {         duration: 500,         fromValue: 5,         toValue: 100,         param: 5,         animationType: AnimationType.Custom     }; /** * @param progress The time progress in the animation loop. A value between 0 and 1. * @param param The user-set value, used to parameterize the animation function. */ function custom(progress, param) {     return Math.pow(Math.E, 1 - (1 / Math.pow(progress, param))); } var animation = new Animation(node, options, null, custom); animation.start(); ``` ## Serializing Diagrams A diagram can be saved as JSON string by calling the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#tojson) method. The produced JSON string could be saved in browser's local storage or sent to a web server to store in a database or a file. Later the diagram's contents can be restored by calling (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#fromjson). The JSON strings are also compatible with MindFusion's ASP.NET MVC API and can be loaded in .NET Diagram object to inspect the diagram model on server side. It is also possible to save a diagram as an XML document. To do that, call the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#savetoxml) method of the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) class. To deserialize a diagram back from its XML representation, call the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#loadfromxml) method. The same XML format is supported by all MindFusion diagram components for mobile, desktop and web platforms. The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#savetostring) and (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#loadfromstring) methods let you serialize or deserialize to/from either JSON or XML strings produced by the other methods described above. ## Miscellaneous ## Associate Custom Data with Items You can associate custom values from any data type with diagram elements by setting their (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#tag) and (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#id) properties. Their values will be automatically serialized to JSON format using browser's JSON serializer when saving diagram JSON files. If saving XML files, you must handle the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#serializetag) and (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#deserializetag) events to save non-string values in XML format. Apart from (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#tag) and (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#id), JavaScript lets you create new object fields dynamically - these however will not be saved automatically in diagram files. ## Fluent API Builder objects with property setter methods and shortcut methods for fonts and brushes add support for fluent programming style. Static With and instance init methods in (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md), (Markdown/CC_T_MindFusion_Diagramming_Style_0.md) and (Markdown/T_MindFusion_Graphs_TreeLayout.md) -derived classes return a builder instance that can be used to set up respective new or existing objects: ```javascript diagram.addItem(     ShapeNode.With()         .brush("lightGray")         .font("Arial", 4)         .enableStyledText(true)         .text("Task 1")         .tooltip("This is the task")         .create()); diagram.getFactory()     .createShapeNode(20, 20, 20, 20).init()         .brush("lightGray", "white", 20)         .font("Arial", 4)         .enableStyledText(true)         .text("Task 2")         .tooltip("This is the second task"); diagram.arrange(     TreeLayout.With()         .levelDistance(20)         .nodeDistance(20)         .linkType(TreeLayoutLinkType.Cascading3)         .create()); ``` ## Tutorials ## Tutorial 1: Loading Graph Data This tutorial shows how to load graph data from a Json string and create diagram objects corresponding to the graph nodes and edges. The code is also available in Samples folder of JsDiagram distribution. 1. Create a text file called Tutorial1.txt and add the following Json string to it: ``` {"nodes":[     {"id":0,"name":"start"},     {"id":1,"name":"activity 1"},     {"id":2,"name":"task 1"},     {"id":3,"name":"task 2"},     {"id":4,"name":"activity 2"},     {"id":5,"name":"task 3"},     {"id":6,"name":"task 4"},     {"id":7,"name":"activity 3"},     {"id":8,"name":"task 5"},     {"id":9,"name":"task 6"},     {"id":10,"name":"end"} ], "links":[     {"origin":0,"target":1},     {"origin":1,"target":2},     {"origin":1,"target":3},     {"origin":2,"target":4},     {"origin":3,"target":4},     {"origin":4,"target":5},     {"origin":4,"target":6},     {"origin":5,"target":10},     {"origin":6,"target":10},     {"origin":0,"target":7},     {"origin":7,"target":8},     {"origin":8,"target":9},     {"origin":2,"target":8},     {"origin":9,"target":10} ]} ``` 2. Create empty Tutorial1.html and Tutorial1.js files, and add DIV and CANVAS elements to the HTML page. ```
            This page requires a browser that supports HTML 5 Canvas element.    
``` 3. Add script references to the MindFusion UMD scripts and Tutorial1 JavaScript files: ``` ``` 4. In Tutorial1.js, assign shorter names to the (Markdown/T_MindFusion_Diagramming_DiagramView.md), (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md), (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md), (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md), (Markdown/T_MindFusion_Graphs_LayeredLayout.md) and (Markdown/T_MindFusion_Drawing_Rect.md) classes (if using diagram's ES6 or CommonJS modules, these would be import or require statements for respective classes and modules). ```javascript var DiagramView = MindFusion.Diagramming.DiagramView; var Diagram = MindFusion.Diagramming.Diagram; var DiagramLink = MindFusion.Diagramming.DiagramLink; var ShapeNode = MindFusion.Diagramming.ShapeNode; var Rect = MindFusion.Drawing.Rect; var LayeredLayout = MindFusion.Graphs.LayeredLayout; ``` 5. Add a DOMContentLoaded handler that creates a (Markdown/T_MindFusion_Diagramming_DiagramView.md) instance wrapping the HTML Canvas element: ```javascript var diagram; document.addEventListener("DOMContentLoaded", function () {     // create a DiagramView component that wraps the "diagram" canvas     var diagramView = DiagramView.create(document.getElementById("diagram"));     diagram = diagramView.diagram; } ``` 6. Add the following code to the DOMContentLoaded handler to create a network request that loads the Json file from the server: ```javascript // pretend we are calling a web service var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { }; xhttp.open("GET", "Tutorial1.txt", true); xhttp.send(); ``` 7. Implement the onreadystatechange handler to parse the json file: ```javascript if (this.readyState == 4 && this.status == 200) {     var graph = JSON.parse(xhttp.responseText);     buildDiagram(graph); } ``` 8. Add the buildDiagram function that creates diagram nodes and links for each object from the parsed Json graph: ```javascript function buildDiagram(graph) {     var nodeMap = [];     // load node data     var nodes = graph.nodes;     for (var node of nodes)     {         var diagramNode = diagram.factory.createShapeNode(0, 0, 18, 8);         nodeMap = diagramNode;         diagramNode.text = node.name;         diagramNode.brush = "#e0e9e9";     }     // load link data     var links = graph.links;     for (var link of links)     {         diagram.factory.createDiagramLink(             nodeMap,             nodeMap);     } } ``` 9. Finally, apply (Markdown/T_MindFusion_Graphs_LayeredLayout.md) to arrange the diagram automatically: ```javascript // arrange the graph var layout = new LayeredLayout(); layout.nodeDistance = 10; layout.layerDistance = 10; diagram.arrange(layout); ``` 10. Publish MindFusion.*.js and tutorial files using web server of your choice. Now you should see this if you open Tutorial1.html in a web browser: ## Tutorial 2: Loading Hierarchical Data This tutorial shows how to load hierarchical data recursively from a Json string and create diagram items corresponding to the hierarchy. The code is also available in Samples folder of JsDiagram distribution. 1. Create a text file called Tutorial2.txt and add the following Json string to it: ``` { "project" :  {"name": "project", "activities":[   {"name":"Activity 1", "activities":[     {"name":"sub-activity 1", "activities":[       {"name":"sub-activity 1-1"},       {"name":"sub-activity 1-2"}]},     {"name":"sub-activity 2", "activities":[       {"name":"sub-activity 2-1"},       {"name":"sub-activity 2-2"},       {"name":"sub-activity 2-3"}]},     {"name":"sub-activity 3", "activities":[       {"name":"sub-activity 3-1"},       {"name":"sub-activity 3-2"}]}   ]},   {"name":"Activity 2", "activities":[     {"name":"sub-activity 1", "activities":[       {"name":"sub-activity 1-1"},       {"name":"sub-activity 1-2"},       {"name":"sub-activity 1-3"}]},     {"name":"sub-activity 2", "activities":[       {"name":"sub-activity 2-1"},       {"name":"sub-activity 2-2"}]}   ]},   {"name":"Activity 3", "activities":[     {"name":"sub-activity 1", "activities":[       {"name":"sub-activity 1-1"},       {"name":"sub-activity 1-2"},       {"name":"sub-activity 1-3"},       {"name":"sub-activity 1-4"}]},     {"name":"sub-activity 2"},     {"name":"sub-activity 3", "activities":[       {"name":"sub-activity 3-1"},       {"name":"sub-activity 3-2"},       {"name":"sub-activity 3-3"}]}   ]}  ]} } ``` 2. Create empty Tutorial2.html and Tutorial2.js files, and add DIV and CANVAS elements to the HTML page. ```
            This page requires a browser that supports HTML 5 Canvas element.    
``` 3. Add script references to the MindFusion UMD scripts and Tutorial2 JavaScript files: ``` ``` 4. In Tutorial2.js, assign shorter names to the (Markdown/T_MindFusion_Diagramming_DiagramView.md), (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md), (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md), (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md), (Markdown/T_MindFusion_Graphs_BorderedTreeLayout.md) and (Markdown/T_MindFusion_Drawing_Rect.md) classes (if using diagram's ES6 or CommonJS modules, these would be import or require statements for respective classes and modules). ```javascript var DiagramView = MindFusion.Diagramming.DiagramView; var Diagram = MindFusion.Diagramming.Diagram; var DiagramLink = MindFusion.Diagramming.DiagramLink; var ShapeNode = MindFusion.Diagramming.ShapeNode; var Rect = MindFusion.Drawing.Rect; var BorderedTreeLayout = MindFusion.Graphs.BorderedTreeLayout; ``` 5. Add a DOMContentLoaded handler that creates a (Markdown/T_MindFusion_Diagramming_DiagramView.md) instance wrapping the HTML Canvas element: ```javascript var diagram = null; document.addEventListener("DOMContentLoaded", function () {     // create a DiagramView component that wraps the "diagram" canvas     var diagramView = DiagramView.create(document.getElementById("diagram"));     diagram = diagramView.diagram; } ``` 6. Add the following members to the script to hold the default node size and color. ```javascript var bounds = new Rect(0, 0, 30, 6); var brush = "LightBlue"; ``` 7. Add the following code to the load handler to create a network request that loads the Json file from the server: ```javascript // pretend we are calling a web service var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { }; xhttp.open("GET", "Tutorial2.txt", true); xhttp.send(); ``` 8. Implement the onreadystatechange handler to parse the json file: ```javascript if (this.readyState == 4 && this.status == 200) {     var graph = JSON.parse(xhttp.responseText);     buildDiagram(graph); } ``` 9. Add the buildDiagram function that creates the tree root node, and call the addActivities function, which builds the tree recursively: ```javascript function buildDiagram(graph) {     // load activity data and create     var project = graph.project;     var diagramNode = diagram.factory.createShapeNode(bounds);     diagramNode.text = project.name;     diagramNode.brush = brush;     if (project.activities)         addActivities(diagramNode, project); } ``` 10. Define addActivities as follows. It takes as parameters the parent (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md) and parent JSON element, iterates the child JSON elements to build the next level of the hierarchy, and creates corresponding diagram items by calling (Markdown/CC_T_MindFusion_Diagramming_Factory_0.md#createshapenode) and (Markdown/CC_T_MindFusion_Diagramming_Factory_0.md#creatediagramlink). ```javascript function addActivities(parentNode, parent) {     for (var activity of parent.activities)     {         var diagramNode = diagram.factory.createShapeNode(bounds);         diagramNode.text = activity.name;         diagramNode.brush = brush;         diagram.factory.createDiagramLink(parentNode, diagramNode);         if (activity.activities)             addActivities(diagramNode, activity);     } } ``` 11. Use (Markdown/T_MindFusion_Graphs_BorderedTreeLayout.md) to arrange the diagram. Add the following code to the end of the buildDiagram function. ```javascript var layout = new BorderedTreeLayout(); layout.direction = MindFusion.Graphs.LayoutDirection.LeftToRight; layout.linkType = MindFusion.Graphs.TreeLayoutLinkType.Cascading; layout.nodeDistance = 1; layout.levelDistance = -8; // let horizontal positions overlap diagram.arrange(layout); diagram.resizeToFitItems(30); ``` 12. Publish MindFusion.*.js and tutorial files using web server of your choice. Now you should see this if you open Tutorial2.html in a web browser: ## Tutorial 3: Create a Custom Node Type This tutorial shows how to define a custom node class that adds several new properties and graphics elements through a template. The code is also available in Samples folder of JsDiagram distribution. 1. Create empty Tutorial3.html and Tutorial3.js files, and add DIV and CANVAS elements to the HTML page. ```
            This page requires a browser that supports HTML 5 Canvas element.    
``` 2. Add script references to the MindFusion UMD scripts and Tutorial3 JavaScript files: ``` ``` 3. In Tutorial3.js, assign shorter names to the (Markdown/T_MindFusion_Diagramming_DiagramView.md), (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md), (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md), (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md), (Markdown/T_MindFusion_Diagramming_Alignment.md) and (Markdown/T_MindFusion_Drawing_Rect.md) types (if using diagram's ES6 or CommonJS modules, these would be import or require statements for respective classes and modules). ```javascript var DiagramView = MindFusion.Diagramming.DiagramView; var Diagram = MindFusion.Diagramming.Diagram; var CompositeNode = MindFusion.Diagramming.CompositeNode; var Behavior = MindFusion.Diagramming.Behavior; var Alignment = MindFusion.Drawing.Alignment; var Rect = MindFusion.Drawing.Rect; ``` 4. In Tutorial3.js call the (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md#classfromtemplate) static method of (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) to generate a node class from a template. The template is defined through an object literal that lists layout containers and graphics primitives from which a node should be composed. ```javascript var OrgChartNode = CompositeNode.classFromTemplate("OrgChartNode", {     component: "GridPanel",     rowDefinitions: ["*"],     columnDefinitions: ["22", "*"],     children:     [         {             component: "Rect",             name: "Background",             pen: "black",             brush: "white",             columnSpan: 2         },         {             component: "Image",             name: "Image",             autoProperty: true,             location: "ceo.png",             margin: "1",             imageAlign: "Fit"         },         {             component: "StackPanel",             orientation: "Vertical",             gridColumn: 1,             margin: "1",             verticalAlignment: "Near",             children:             [                 {                     component: "Text",                     name: "Title",                     autoProperty: true,                     text: "title",                     font: "Calibri bold"                 },                 {                     component: "Text",                     name: "FullName",                     autoProperty: true,                     text: "full name",                     pen: "blue",                     font: "Calibri 4",                     padding: "1,0,1,0"                 },                 {                     component: "Text",                     name: "Details",                     autoProperty: true,                     text: "details",                     font: "Calibri 3"                 }             ]         }     ] }); Diagram.registerClass(OrgChartNode, "OrgChartNode", "OrgChartNode", 1, CompositeNode); ``` 5. Create a (Markdown/T_MindFusion_Diagramming_DiagramView.md) instance wrapping the HTML Canvas element. Add some nodes of the new class and create links between them. The autoProperty attribute in template above will generate setter methods for properties whose name is specified via name attribute. ```javascript var diagram = null; document.addEventListener("DOMContentLoaded", function () {     // create a DiagramView component that wraps the "diagram" canvas     var diagramView = DiagramView.create(document.getElementById("diagram"));     diagram = diagramView.diagram;     // enable drawing of custom nodes interactively     diagram.customNodeType = OrgChartNode;     diagramView.behavior = Behavior.Custom;     var node1 = new OrgChartNode(diagram);     node1.bounds = new Rect(25, 15, 60, 25);     node1.title = "CEO";     node1.fullName = "John Smith";     node1.details =         "Our beloved leader. \r\n" +         "The CEO of this great corporation.";     node1.image = "ceo.png";     diagram.addItem(node1);     var node2 = new OrgChartNode(diagram);     node2.bounds = new Rect(25, 55, 60, 25);     node2.title = "CTO";     node2.fullName = "Bob Smith";     node2.details = "The technology chief of this great corporation.";     node2.image = "cto.png";     diagram.addItem(node2);     // ...     diagram.factory.createDiagramLink(node1, node2); }); ``` 6. Publish MindFusion.*.js and tutorial files using web server of your choice. Now you should see this if you open Tutorial3.html in a web browser: ## Tutorial 4: Custom Nodes Integration This tutorial builds upon the OrgChartNode type from (#tutorial-3-create-a-custom-node-type). It shows how to fully integrate the custom type with other MindFusion.Diagramming for JavaScript features, such as clipboard support, undo support, creating nodes by drag-and-drop or drawing with the mouse on the canvas. The code is also available in Samples folder of JsDiagram distribution. 1. Create copies of (#tutorial-3-create-a-custom-node-type) files - Tutorail3.html and Tutorial3.js and name them Tuturial4.html and Tutorial4.js respectively. 2. Add a DIV and CANVAS elements to Tutorial4.html that will represent a (Markdown/T_MindFusion_Diagramming_NodeListView.md) control: ```
       
``` 3. Add five buttons to the page - copy, cut, paste, undo and redo - and define click handlers that will be used to call the corresponding diagram methods. ``` ``` 4. Add shortcuts to the (Markdown/T_MindFusion_Diagramming_NodeListView.md) and (Markdown/T_MindFusion_Drawing_Size.md) classes in Tutorial4.js and define a nodeListView variable. ```javascript var NodeListView = MindFusion.Diagramming.NodeListView; var Size = MindFusion.Drawing.Size; var nodeListView = null; ``` 5. Classes generated by calling (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md#classfromtemplate) implement undo/redo, clipboard and serialization support for their auto-properties out of the box. When creating more complex types with their own data properties, you'd need to implement serialization and cloning for them yourself. Lets show how to implement the various operations by creating a new class that adds a custom property. Start by renaming the class from tutorial 3 to TemplatedBase, and creating a new OrgChartNode class that derives from it. ```javascript var TemplatedBase = CompositeNode.classFromTemplate("TemplatedBase",     // ... function OrgChartNode(parent) {     var _this = TemplatedBase.call(this, parent);     _this.cost = "low";     return _this; }; OrgChartNode.prototype.getCost = function () {     return this.cost; }; OrgChartNode.prototype.setCost = function (value) {     this.cost = value; }; Diagram.registerClass(OrgChartNode, "OrgChartNode", "OrgChartNode", 1, TemplatedBase); ``` 6. Add a clone method override to the OrgChartNode prototype. ```javascript // support for the NodeListView drag and drop OrgChartNode.prototype.clone = function () {     var copy = TemplatedBase.prototype.clone.call(this);     copy.cost = this.cost;     return copy; }; ``` 7. To implement clipboard support of any new properties added by a custom item class, add (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#fromjson) and (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#tojson) method overrides to the prototype definition: ```javascript // clipboard and serialization support OrgChartNode.prototype.toJson = function () {     var json = TemplatedBase.prototype.toJson.call(this);     json.cost = this.cost;     return json; }; OrgChartNode.prototype.fromJson = function (json) {     TemplatedBase.prototype.fromJson.call(this, json);     this.cost = json.cost; }; ``` 8. In order to enable undo / redo of changes done on OrgChartNode, add (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#savestate) and (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md#restorestate) method overrides to the prototype definition: ```javascript // undo/redo OrgChartNode.prototype.saveState = function () {     var state = TemplatedBase.prototype.saveState.call(this);     state.cost = this.cost;     return state; }; OrgChartNode.prototype.restoreState = function (state) {     TemplatedBase.prototype.restoreState.call(this, state);     this.cost = state.cost; }; ``` 9. In order to enable drawing OrgChartNodes with the mouse, add the following code to the DOMContentLoaded handler: ```javascript // enable drawing of custom nodes interactively diagramView.behavior = Behavior.Custom; diagram.customNodeType = OrgChartNode; ``` 10. To enable undo / redo support on the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) object, set its (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#undoenabled) property to true in the DOMContentLoaded handler. ```javascript // enable undo/redo support diagram.undoEnabled = true; ``` 11. Finally, add initialization code for the  (Markdown/T_MindFusion_Diagramming_NodeListView.md) to the load hadler. ```javascript // create a NodeListView component that wraps the "nodeListView" canvas nodeListView = NodeListView.create(document.getElementById("nodeListView")); nodeListView.measureUnit = 6; nodeListView.padding = 1; nodeListView.iconSize = new Size(65, 25); nodeListView.defaultNodeSize = new Size(65, 25); // create and add some nodes to the node list var node1 = new OrgChartNode(nodeListView); node1.title = "Skiing"; node1.fullName = "Winter"; node1.details =     "Vacation in the snow. \r\n" +     "Ski lessons, ski equipment and winter sports."; node1.image = "snowman.png"; node1.cost = "high"; nodeListView.addNode(node1, ""); var node2 = new OrgChartNode(nodeListView); node2.title = "Seaside"; node2.fullName = "Summer"; node2.details = "Sun bathing, swimming, catching tan."; node2.image = "seaside.png"; node2.cost = "high"; nodeListView.addNode(node2, ""); ``` 12. Publish MindFusion.*.js and tutorial files using web server of your choice. Open Tutorial4.html in a web browser and you should be able to create nodes by drag and drop from (Markdown/T_MindFusion_Diagramming_NodeListView.md), copy and paste them, and redo/undo operations done on them. ## Integration with UI Frameworks ## React ### Functional components The DiagramView React component allows integrating the MindFusion.Diagramming API into React applications. It renders a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) instance assigned to "diagram" prop as its model. At this time, the following properties can be set from JSX too: allowInplaceEdit, autoResize, backBrush, behavior, defaultShape, enabled, linkHeadShapeSize, linkShape, roundedLinks, routeLinks, showAnchors, showGrid, zoomFactor. All diagram (#diagram-events) can be handled through JSX syntax as well: ```javascript const = useState(new Diagramming.Diagram()); ... onDiagramChanged(diagram, args)}     onNodeCreated={(diagram, args) => onDiagramNodeCreated(diagram, args)} /> ``` The DiagramView control exposes a forwardRef, that can be passed on to other controls, such as the (Markdown/T_MindFusion_Diagramming_Overview.md) and (Markdown/T_MindFusion_Controls_ZoomControl.md). To obtain a reference to the underlying core controls, use the respective (Markdown/T_MindFusion_Diagramming_DiagramView.md#find) method of the ref. DiagramView can be installed from the @mindfusion/diagramming-react package on npm: npm i @mindfusion/diagramming-react Several React examples are included in JsDiagram's distribution. In order to run them, execute the following npm commands from command line in Samples/React folder: npm install npm start ### Class components Older class-component wrappers have been moved to the @mindfusion/diagramming-react-cc package. Using them looks like this: ```javascript this.state.diagram = new Diagramming.Diagram(); ... this.onDiagramNodeClicked(diagram, args)}     onLinkCreating={(diagram, args) => this.onDiagramLinkCreating(diagram, args)}     onDiagramChanged={diagram => this.onDiagramChanged(diagram)} /> ``` Class components can be installed from the @mindfusion/diagramming-react-cc package on npm: npm i @mindfusion/diagramming-react-cc ## Vue.js The diagram-view Vue.js component allows integrating the MindFusion.Diagramming API into Vue.js applications. It renders a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) instance assigned to "diagram" prop as its model. At this time the following properties can be set from vue templates too: allowInplaceEdit, autoResize, backBrush, behavior, defaultShape, enabled, linkHeadShapeSize, linkShape, roundedLinks, routeLinks, showAnchors, showGrid, zoomFactor. All diagram (#diagram-events) can be handled through the v-on directive as well: ``` this.diagram = new Diagramming.Diagram(); ... ``` diagram-view can be installed from the @mindfusion/diagramming-vue package on npm: npm i @mindfusion/diagramming-vue Several Vue.js examples are included in JsDiagram's distribution. In order to run them, execute the following npm commands from command line in Samples/Vue folder: npm install npm run serve ## Angular The DiagramView Angular component (diagram-view selector) allows integrating the MindFusion.Diagramming API into Angular applications. It renders a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) instance assigned to "diagram" property as its model. At this time the following properties can be set from HTML templates too: allowInplaceEdit, autoResize, backBrush, behavior, defaultShape, enabled, linkHeadShapeSize, linkShape, roundedLinks, routeLinks, showAnchors, showGrid, zoomFactor. All diagram events can be handled through event binding syntax as well: ``` import { DiagrammingAngularModule } from '@mindfusion/diagramming-angular'; ``` ``` ``` ``` import * as Diagramming from '@mindfusion/diagramming'; ... // declare properties autoResize = Diagramming.AutoResize.None; behavior = Diagramming.Behavior.DrawShapes; diagram : Diagramming.Diagram; ... // instantiate a Diagram model this.diagram = new Diagramming.Diagram(); ``` DiagramView can be installed from the @mindfusion/diagramming-angular package on npm: npm i @mindfusion/diagramming-angular Several Angular examples are included in JsDiagram's distribution. In order to run them, execute the following npm commands from command line in Samples/Angular folder: npm install npm start ## Blazor JsDiagram's Blazor bindings allow integrating the JavaScript diagramming library into Blazor applications. It contains a set of .NET wrapper classes, that use Blazor's JSInterop API to create and manipulate the client-side objects. The package provides easy access from C# code to the most of the MindFusion.Diagramming functionality, including different node types, layouts and styling. Additional UI components such as (Markdown/T_MindFusion_Diagramming_Overview.md), (Markdown/T_MindFusion_Diagramming_NodeListView.md), (Markdown/T_MindFusion_Controls_ZoomControl.md) and (Markdown/T_MindFusion_Diagramming_Ruler_0.md) are included too. The following steps describe how to add a (Markdown/T_MindFusion_Diagramming_DiagramView.md) to Blazor application: 1. Create a new Blazor WebAssembly App project. 2. Install the MindFusion.Diagramming.JavaScript NuGet package. 3. Add the importmap script for @mindfusion modules: ```         ... ``` 4. Add imports to the top of _Imports.razor (or the top of Index.razor page): ``` @using MindFusion.Diagramming.JavaScript ``` 5. Add the (Markdown/T_MindFusion_Diagramming_DiagramView.md) component razor tag: ``` ``` Optionally add styles: ``` ``` Optionally set component parameters and add event handlers: ``` ``` 6. Create the (Markdown/T_MindFusion_Diagramming_DiagramView.md) instance: ```csharp @code {     private DiagramView diagramView = null!;     protected override async Task OnAfterRenderAsync(bool firstRender)     {         if (firstRender)         {             await diagramView.CreateAsync();         }     }     // The event handler for the NodeCreated event     private async Task OnNodeCreated(NodeEventArgs args)     {         args.Node.Text = "some text";     } } ``` 7. Obtain a reference to the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) instance and add nodes and links ```csharp @code {     private DiagramView diagramView = null!;     private Diagram diagram = null!;     protected override async Task OnAfterRenderAsync(bool firstRender)     {         if (firstRender)         {             await diagramView.CreateAsync();             diagram = diagramView.Diagram;             diagram.RouteLinks = true;             // create a Container node             var container = await diagram.Factory.CreateContainerNode(10, 20, 40, 60);             // create a Shape node             var shapeNode = await diagram.Factory.CreateShapeNode(100, 20, 20, 20);             shapeNode.Shape = Shape.FromId("Decision");             // create a link             diagram.Factory.CreateDiagramLink(container, shapeNode);         }     } } ``` Alternatively, the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) instance can be created first and then passed to the (Markdown/T_MindFusion_Diagramming_DiagramView.md) component as a parameter of its CreateAsync method. To create the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) instance use the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md)'s static CreateAsync method. ```csharp @inject IJSRuntime JS ...     await MindFusion.JavaScript.BlazorInterop.ImportModules(JS!);     Diagram diagram = await Diagram.CreateAsync();     // ... set diagram properties/items/etc. here     await diagramView.CreateAsync(diagram); // or      Diagram diagram = await Diagram.CreateAsync(JS!);     // ... set diagram properties/items/etc. here     await diagramView.CreateAsync(diagram); ``` References to the JS modules can be disposed by using the DisposeModules method ```csharp async ValueTask IAsyncDisposable.DisposeAsync() {     await MindFusion.JavaScript.BlazorInterop.DisposeModules(); } ``` ## Reference ## Table of Predefined Shapes | **Shape ** | **Identifier ** | **Common Uses ** | | Actor | A user An actor in use case model | | Alternative | An alternative in SDL An extraction in flowcharts Storage in quality management | | Arrow1 | Use as desired | | Arrow2 | Use as desired | | Arrow3 | Transportation in quality management A reference point | | Arrow4 | Use as desired | | Arrow5 | Use as desired | | Arrow6 | Use as desired | | Arrow7 | A signal Electronic transmission of data | | Arrow8 | Use as desired | | Arrow9 | Use as desired | | BeginLoop | Begin of a loop | | BpmnComplex | BPMN Gateways: Complex Decision/Merge | | BpmnDataBasedXor | BPMN Gateways: Data-Based Exclusive Decision/Merge (XOR) | | BpmnEndCancel | BPMN Events: Cancel (End) | | BpmnEndCompensation | BPMN Events: Compensation (End) | | BpmnEndError | BPMN Events: Error (End) | | BpmnEndLink | BPMN Events: Link (End) | | BpmnEndMessage | BPMN Events: Message (End) | | BpmnEndMultiple | BPMN Events: Multiple (End) | | BpmnEndTerminate | BPMN Events: Terminate (End) | | BpmnEventBasedXor | BPMN Gateways: Event-Based Exclusive Decision/Merge (XOR) | | BpmnInclusive | BPMN Gateways: Inclusive Decision/Merge (OR) | | BpmnIntermediateCancel | BPMN Events: Cancel (Intermediate) | | BpmnIntermediateCompensation | BPMN Events: Compensation (Intermediate) | | BpmnIntermediateError | BPMN Events: Error (Intermediate) | | BpmnIntermediateLink | BPMN Events: Link (Intermediate) | | BpmnIntermediateMessage | BPMN Events: Message (Intermediate) | | BpmnIntermediateMultiple | BPMN Events: Multiple (Intermediate) | | BpmnIntermediateRule | BPMN Events: Rule (Intermediate) | | BpmnIntermediateTimer | BPMN Events: Timer (Intermediate) | | BpmnParallelFork | BPMN Gateways: Parallel Fork/Join (AND) | | BpmnStartLink | BPMN Events: Link (Start) | | BpmnStartMessage | BPMN Events: Message (Start) | | BpmnStartMultiple | BPMN Events: Multiple (Start) | | BpmnStartRule | BPMN Events: Rule (Start) | | BpmnStartTimer | BPMN Events: Timer (Start) | | Cloud | Object instance in data flow diagrams | | Collate | A collation in flowcharts | | ConeDown | Use as desired | | ConeUp | Use as desired | | ConnectedIssues | Connected issues in quality management | | CreateRequest | Request to create in SDL | | Cross | Use as desired | | Cube | Use as desired | | Cylinder | Use as desired | | Database | A database in flowcharts | | DataTransmition | Electronic transmission of data | | DDelay | Use as desired | | Decagon | Use as desired | | Decision | Decision in flowcharts A comparison in flowcharts Relationship in data flow diagrams | | Decision2 | A decision in SDL | | Delay | A delay in process diagrams | | DInDelay | Use as desired | | DirectAccessStorage | A direct access storage | | DiskStorage | Data stored on disk in flowcharts | | Display | Data that is displayed for human use | | DividedEvent | An event | | DividedProcess | A process or document in flowcharts Entity in data flow diagrams | | Document | A document | | Donut | Use as desired | | DOutDelay | Use as desired | | Ellipse | A cross-reference within the same page of a flowchart Process in data flow diagrams State in data flow diagrams A continuation of the flowchart in SDL An use case Operation in quality management | | EndLoop | End of a loop | | ExternalOrganization | An external organization | | ExternalProcess | An external process | | File | A file | | FramedRectangle | Use as desired | | Gate | A gateway | | Heart | Use as desired | | Heptagon | Use as desired | | Hourglass | Use as desired | | Input | Data that is input by manual means | | InternalStorage | An internal storage | | Interrupt | An interrupt | | Interrupt2 | An interrupt | | IsoProcess | Iso9000 process | | Junction | A summing junction A return in SDL | | Lightning | Use as desired | | LinedDocument | A document in flowcharts | | ManualOperation | Operation performed by a human | | Merge | A merger in flowcharts Inbound goods in quality management Non-electronic file Stop state in data flow diagrams | | MessageFromUser | A message from user side in SDL | | MessageToUser | A message to user side in SDL | | Microform | A microform | | MicroformProcessing | A microform processing | | MicroformRecording | A microform recording | | MultiDocument | A multiple document in flowcharts | | MultiProc | A multiple process or document in flowcharts | | Octagon | Use as desired | | OfflineStorage | An offline storage | | OffpageConnection | A cross-reference to another page of a flowchart | | OffpageReference | A cross-reference to another page of a flowchart A foreign module | | Or | An 'or' statement | | Pentagon | Use as desired | | Plaque | Use as desired | | PrimitiveFromCall | A primitive from call control in SDL | | PrimitiveToCall | A primitive to call control in SDL | | Procedure | Procedure in SDL | | Process | A process or document in flowcharts A file or data storage | | Prysm | Use as desired | | PunchedCard | A punched card | | PyramidDown | Use as desired | | PyramidUp | Use as desired | | Rectangle | A metric operation 'External interactor' in data flow diagrams Inspection in quality management | | RightTriangle | Use as desired | | RoundRect | A process or item in flowcharts An event An issue in quality management | | RSave | Input or output data in flowcharts | | Save | A save in SDL Input or output data in flowcharts | | Sort | A sort operation | | Sphere | Use as desired | | Star | Use as desired | | Star4Pointed | Use as desired | | Star5Pointed | Use as desired | | Star6Pointed | Use as desired | | Star7Pointed | Use as desired | | Star16Pointed | Use as desired | | Star24Pointed | Use as desired | | Star32Pointed | Use as desired | | Start | Start of a program flow A starting point in SDL | | Tape | Sequentially accessible data | | Terminator | Start or end of a program flow | | TransmittalTape | A transmittal tape | | Trapezoid | Use as desired ## Licensing For non-commercial use, you can disable evaluation mode by adding an https://mindfusion.dev/ link to your page, and assigning the link's id value to the linkBackId property of (Markdown/T_MindFusion_Diagramming_DiagramView.md). For example: ``` ``` ```javascript diagramView.linkBackId = "mindfusionLink"; ``` If you have a commercial license, copy your license key to a mindfusion_lic.txt file in same folder where the diagram html page is located. The file name and location can be changed by setting DiagramView's (Markdown/T_MindFusion_Diagramming_DiagramView.md#licenselocation) property. Alternatively, the key string can be assigned directly to view's licenseKey property. MindFusion.Diagramming licenses are perpetual and royalty-free. When you purchase the component, you can find its license key string in confirmation e-mail, and also listed on Keys & Downloads page at our client portal. ## Online Resources ### Video Tutorials - Create, edit, save and load diagrams using JavaScript and HTML - A JavaScript application for server load monitoring - Interactive org chart in JavaScript ### Blog Posts - A block diagram editor - Organizational chart tutorial - Using MindFusion JavaScript Components With WordPress Elementor Plugin - Custom Diagram Nodes With Clipped Images ## Technical Support Detailed information about everything connected with software products offered by MindFusion - online documentation, demos, information about forthcoming products can be found at https://mindfusion.dev. The site is updated every day, so make sure you visit it regularly to catch up with the newest from us. Apart from that, MindFusion employs a dedicated and technically proficient support team. This guarantees that all your questions and inquiries will be answered in quick and professional manner. They can be reached by e-mail at support@mindfusion.eu or by phone at +359 888 951737. You can post a question on the MindFusion.Diagramming for JavaScript discussion board here: https://mindfusion.dev/Forum/YaBB.pl?board=jsdiag_disc or visit our Help Desk site: https://mindfusion.dev/HelpDesk/index.php We will be happy to hear any suggestions and recommendations you might have regarding MindFusion.Diagramming for JavaScript. We do take in account the opinion of every single person who has shown interest in our products. ## MindFusion Products MindFusion offers various programming components for different platforms. Below is a list of our products with links to their sections on our website as well link to download a trial version. Clients that have already purchased a product use an increasing discount for each subsequent one. | **Diagramming ** | **Links ** | Diagramming for WPF | Product Information Download | Diagramming for WinForms | Product Information Download | Diagramming for Java Swing | Product Information Download | Diagramming for JavaScript | Product Information Download | Diagramming for ASP.NET | Product Information Download | Diagramming for ASP.NET MVC | Product Information Download | Diagramming for Xamarin | Product Information Download | Diagramming for UWP | Product Information Download | Diagramming for Android | Product Information Download | DiagramViewer for iOS/Cocoa Touch | Product Information Download | Diagramming for ActiveX | Product Information Download | Diagramming for Silverlight | Product Information Download | **Charting ** | **Links ** | Charting for WPF | Product Information Download | Charting for WinForms | Product Information Download | Charting for Java Swing | Product Information Download | Charting for JavaScript | Product Information Download | Charting for ASP.NET | Product Information Download | Charting for Xamarin | Product Information Download | Charting for Android | Product Information Download | Charting for Silverlight | Product Information Download | **Scheduling ** | **Links ** | Scheduling for WPF | Product Information Download | Scheduling for WinForms | Product Information Download | Scheduling for Java Swing | Product Information Download | Scheduling for JavaScript | Product Information Download | Scheduling for ASP.NET | Product Information Download | Scheduling for Xamarin | Product Information Download | Scheduling for Silverlight | Product Information Download | **Spreadsheet ** | **Links ** | Spreadsheet for WPF | Product Information Download | Spreadsheet for WinForms | Product Information Download | Spreadsheet for Java Swing | Product Information Download | **Reporting ** | **Links ** | Reporting for WPF | Product Information Download | Reporting for WinForms | Product Information Download | Reporting for Silverlight | Product Information Download | **Virtual Keyboard ** | **Links ** | Virtual Keyboard for WPF | Product Information Download | Virtual Keyboard for WinForms | Product Information Download | Virtual Keyboard for Java Swing | Product Information Download | Virtual Keyboard for JavaScript | Product Information Download | **Mapping ** | **Links ** | Mapping for WPF | Product Information Download | Mapping for WinForms | Product Information Download | Mapping for ASP.NET | Product Information Download | Mapping for Silverlight | Product Information Download | **Suites ** | **Links ** | Pack for WPF | Product Information Download | Pack for WinForms | Product Information Download | Pack for Java Swing | Product Information Download | Pack for JavaScript | Product Information Download | Pack for ASP.NET | Product Information Download | Pack for Xamarin | Product Information Download | Pack for Silverlight | Product Information Download | Pack for Diagramming | Product Information Download | Pack for Scheduling | Product Information Download # Section 2: API Class Reference The following are links to the consolidated class reference guides. Each file contains all constructors, fields, properties, methods, and events for that class. ### Namespace MindFusion.Animations - [Animation Class](Markdown/T_MindFusion_Animations_Animation.md): Represents an object that is used to animate diagram items on the canvas. - [AnimationType Enumeration](Markdown/T_MindFusion_Animations_AnimationType.md): Specifies the animation function used by an (Markdown/T_MindFusion_Animations_Animation.md) object. - [EasingType Enumeration](Markdown/T_MindFusion_Animations_EasingType.md): Specifies the easing applied to an animation. - [Events Class](Markdown/T_MindFusion_Animations_Events.md): Defines all events raised in the Animations namespace. ### Namespace MindFusion.Collections - [Grid Class](Markdown/T_MindFusion_Collections_Grid.md): Represents a collection of tabular data. - [Queue Class](Markdown/T_MindFusion_Collections_Queue.md): Represents a first-in, first-out collection of objects. ### Namespace MindFusion.Controls - [Alignment Enumeration](Markdown/T_MindFusion_Controls_Alignment.md): Specifies the alignment of text relative to its layout rectangle. - [CancelEventArgs Class](Markdown/T_MindFusion_Controls_CancelEventArgs.md): Provides a value to use with cancellable events. - [Canvas Class](Markdown/T_MindFusion_Controls_Canvas.md): Handles drawing on a CanvasRenderingContext2D. - [CanvasControl Class](Markdown/T_MindFusion_Controls_CanvasControl.md): The CanvasControl class represents a wrapper class for the HTML5 Canvas element. - [Control Class](Markdown/T_MindFusion_Controls_Control.md): A base class for MindFusion controls. - [Disposable Class](Markdown/T_MindFusion_Controls_Disposable.md): Disposable abstract class. - [DomUtils Class](Markdown/T_MindFusion_Controls_DomUtils.md): Contains DOM-related helper functions. - [EventArgs Class](Markdown/T_MindFusion_Controls_EventArgs.md): The base type of classes that define arguments passed to event handler functions. - [EventDispatcher Class](Markdown/T_MindFusion_Controls_EventDispatcher.md): Represents a dispatcher for an event. - [Events Class](Markdown/T_MindFusion_Controls_Events_0.md): Defines all events raised in the Controls namespace. - [MouseButton Enumeration](Markdown/T_MindFusion_Controls_MouseButton.md): Specifies which button was pressed to trigger the event. - [MouseCursors Enumeration](Markdown/T_MindFusion_Controls_MouseCursors.md): Specifies the type of the mouse cursor. - [TickPosition Enumeration](Markdown/T_MindFusion_Controls_TickPosition.md): Specifies the position of trackbar ticks. - [WebComponents Class](Markdown/T_MindFusion_Controls_WebComponents.md): Implements registration of web components. - [ZoomControl Class](Markdown/T_MindFusion_Controls_ZoomControl.md): The (Markdown/T_MindFusion_Controls_ZoomControl.md) lets users zoom and pan a target view control interactively. ### Namespace MindFusion.Diagramming - [Action Enumeration](Markdown/CC_T_MindFusion_Diagramming_Action_0.md): Specifies the possible actions a user can carry out on diagram items. - [AddItemCommand Class](Markdown/T_MindFusion_Diagramming_AddItemCommand.md): Implements creation of new diagram items. - [AdjustmentHandles Enumeration](Markdown/CC_T_MindFusion_Diagramming_AdjustmentHandles_0.md): Identifies the distinct selection handles of a (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md). - [AeroEffect Class](Markdown/T_MindFusion_Diagramming_AeroEffect_0.md): Represents an effect that adds semitransparency to the node and emphasizes its outline by adding a shade and an inner stroke. - [Alignment Enumeration](Markdown/T_MindFusion_Diagramming_Alignment.md): Specifies the alignment of text relative to its layout rectangle. - [AnchorPattern Class](Markdown/CC_T_MindFusion_Diagramming_AnchorPattern_0.md): The (Markdown/CC_T_MindFusion_Diagramming_AnchorPattern_0.md) class represents a set of anchor points, which specify the exact locations where links are allowed to connect to nodes. - [AnchorPoint Class](Markdown/CC_T_MindFusion_Diagramming_AnchorPoint_0.md): The (Markdown/CC_T_MindFusion_Diagramming_AnchorPoint_0.md) class represents a location in a node to which links are allowed to connect. - [ArrowHeads Class](Markdown/T_MindFusion_Diagramming_ArrowHeads_1.md): Provides acccess to predefined arrowhead shapes. - [AutoResize Enumeration](Markdown/T_MindFusion_Diagramming_AutoResize_0.md): Defines in which directions automatic resizing can enlarge the diagram scrollable area. - [Behavior Enumeration](Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md): Defines values that specify how the component responds to actions performed by the user. - [BehaviorBase Class](Markdown/T_MindFusion_Diagramming_BehaviorBase.md): An abstract base class for types that define how the control reacts to users' actions with a mouse or other pointing devices. - [Border Class](Markdown/T_MindFusion_Diagramming_Border.md): Represents a panel that draws a border around its child components. - [Builder Class](Markdown/T_MindFusion_Diagramming_Builder.md): Provides support for fluent API. - [Button Class](Markdown/T_MindFusion_Diagramming_Button.md): Represents a button component for (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md)s. - [CaptionedNode Class](Markdown/T_MindFusion_Diagramming_CaptionedNode.md): CaptionedNode is an abstract base class from which the (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md), (Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md) and (Markdown/T_MindFusion_Di... - [Cell Class](Markdown/T_MindFusion_Diagramming_Cell.md): Represents a cell of a (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md). - [CellEventArgs Class](Markdown/T_MindFusion_Diagramming_CellEventArgs_0.md): Contains the arguments passed to handlers of table cell -related events. - [CellFrameStyle Enumeration](Markdown/T_MindFusion_Diagramming_CellFrameStyle_0.md): Specifies the style of the cells' frame lines. - [ChangeItemCommand Class](Markdown/T_MindFusion_Diagramming_ChangeItemCommand.md): Handles undo / redo of property changes. - [ColumnStyle Enumeration](Markdown/T_MindFusion_Diagramming_ColumnStyle_0.md): Specifies how table columns' width is set. - [Command Class](Markdown/T_MindFusion_Diagramming_Command.md): Represents an action that changes the diagram and whose effects can be undone. - [CompatConfig Class](Markdown/T_MindFusion_Diagramming_CompatConfig.md): Contains API compatibility settings. - [ComponentEventArgs Class](Markdown/T_MindFusion_Diagramming_ComponentEventArgs.md): Contains the arguments passed to handlers of component-related events. - [CompositeCommand Class](Markdown/T_MindFusion_Diagramming_CompositeCommand.md): Represents a set of (Markdown/T_MindFusion_Diagramming_Command.md) instances as a single operation. Undoing or redoing the composite action, respectively undoes or redoes all its constituent subact... - [CompositeNode Class](Markdown/T_MindFusion_Diagramming_CompositeNode_0.md): (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) implements nodes whose appearance can be defined via composition of components and layout containers. - [CompositeRouter Class](Markdown/T_MindFusion_Diagramming_CompositeRouter_0.md): Implements a chain of link routers so that a link passes through the sequence until it gets routed successfully. - [ConnectionPoint Class](Markdown/CC_T_MindFusion_Diagramming_ConnectionPoint_0.md): A class that represents a connection between an edge and a node in a graph. It decouples the (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) class from the (Markdown/CC_T_MindFusion_Diagram... - [ConnectionStyle Enumeration](Markdown/T_MindFusion_Diagramming_ConnectionStyle.md): Specifies whether links should connect to a node or its rows. - [ContainerNode Class](Markdown/CC_T_MindFusion_Diagramming_ContainerNode_0.md): ContainerNode instances are diagram nodes that can contain other nodes. - [ContainerPage Class](Markdown/T_MindFusion_Diagramming_ContainerPage.md): Represents a page in a (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md). - [ContainerPagesCommand Class](Markdown/T_MindFusion_Diagramming_ContainerPagesCommand.md): Tracks changes of the pages collection of a (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md). - [ControlNode Class](Markdown/T_MindFusion_Diagramming_ControlNode_0.md): (Markdown/T_MindFusion_Diagramming_ControlNode_0.md) instances are diagram nodes that render HTML content. - [CreateLinkController Class](Markdown/T_MindFusion_Diagramming_CreateLinkController.md): A controller used to draw new links in the diagram. - [CreateNodeController Class](Markdown/T_MindFusion_Diagramming_CreateNodeController.md): A controller used to draw new nodes in the diagram. - [CreateSelectionController Class](Markdown/T_MindFusion_Diagramming_CreateSelectionController.md): A controller used to draw selection rectangle in the diagram. - [DelKeyAction Enumeration](Markdown/CC_T_MindFusion_Diagramming_DelKeyAction_0.md): Specifies the type of action performed when the user presses the DEL key. - [Diagram Class](Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md): The (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) class represents a flow diagram. - [DiagramBase Class](Markdown/T_MindFusion_Diagramming_DiagramBase_1.md): The base class of the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) and (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md) classes. - [DiagramDocument Class](Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md): Represents a collection of diagram pages. - [DiagramEventArgs Class](Markdown/T_MindFusion_Diagramming_DiagramEventArgs_0.md): Contains the arguments passed to handlers of global diagram events such as (Markdown/T_MindFusion_Diagramming_Events.md#clicked). - [DiagramItem Class](Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md): Represents an item in the diagram model. All classes representing diagram elements derive from (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md). - [DiagramLink Class](Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md): Represents a link between two diagram nodes. - [DiagramNode Class](Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md): Represents a diagram node. - [DiagramPage Class](Markdown/T_MindFusion_Diagramming_DiagramPage_1.md): Represents a single page in a (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md) object. - [DiagramView Class](Markdown/T_MindFusion_Diagramming_DiagramView.md): Represents a control that displays the content of a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) object. - [DirectionConstraint Enumeration](Markdown/T_MindFusion_Diagramming_DirectionConstraint_1.md): Defines values that specify in what direction to constrain node movement. - [DoNothingBehavior Class](Markdown/T_MindFusion_Diagramming_DoNothingBehavior.md): Implements the (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md) behavior. - [DrawAnchorPointEventArgs Class](Markdown/T_MindFusion_Diagramming_DrawAnchorPointEventArgs_0.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#drawanchorpoint) event handlers. - [DrawLinksBehavior Class](Markdown/T_MindFusion_Diagramming_DrawLinksBehavior.md): This class is used when the diagram behavior is set to (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md). - [DrawNodesBehavior Class](Markdown/T_MindFusion_Diagramming_DrawNodesBehavior.md): The base class for behavior types that allow drawing of nodes, but not links. - [DrawShapesBehavior Class](Markdown/T_MindFusion_Diagramming_DrawShapesBehavior.md): This class is used when the diagram behavior is set to Behavior.DrawShapes. - [DummyNode Class](Markdown/T_MindFusion_Diagramming_DummyNode_0.md): (Markdown/T_MindFusion_Diagramming_DummyNode_0.md) represents virtual nodes set as targets of disconnected links. - [EffectPhase Enumeration](Markdown/T_MindFusion_Diagramming_EffectPhase.md): Specifies the rendering phase during which an effect application is requested. - [Events Class](Markdown/T_MindFusion_Diagramming_Events.md): Obsolete. Defines all events raised by the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) component. - [ExpandButtonAction Enumeration](Markdown/T_MindFusion_Diagramming_ExpandButtonAction_1.md): Specifies what action is triggered by the +/- buttons that are displayed near expandable nodes. - [Factory Class](Markdown/CC_T_MindFusion_Diagramming_Factory_0.md): Provides shortcut methods for creating and adding instances of the standard item types. - [FitSize Enumeration](Markdown/T_MindFusion_Diagramming_FitSize_0.md): Specifies how the (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md#resizetofittext) method should resize a node. - [FoldContainerCommand Class](Markdown/T_MindFusion_Diagramming_FoldContainerCommand.md): Handles undo / redo of container folding. - [FreeFormNode Class](Markdown/T_MindFusion_Diagramming_FreeFormNode_0.md): A (Markdown/T_MindFusion_Diagramming_FreeFormNode_0.md) collects all points from users' mouse or touch input and displays them as node's outline. - [GlassEffect Class](Markdown/T_MindFusion_Diagramming_GlassEffect_0.md): Represents a glass-like visual effect. - [GlassEffectType Enumeration](Markdown/T_MindFusion_Diagramming_GlassEffectType_0.md): Specifies the type of a (Markdown/T_MindFusion_Diagramming_GlassEffect_0.md) node effect. - [GridColumn Class](Markdown/T_MindFusion_Diagramming_GridColumn.md): Represents a column in a (Markdown/T_MindFusion_Diagramming_GridPanel.md). - [GridPanel Class](Markdown/T_MindFusion_Diagramming_GridPanel.md): A layout container that arranges its child components in a grid. - [GridRouter Class](Markdown/T_MindFusion_Diagramming_GridRouter_1.md): Implements a link routing algorithm that uses a grid to represent the free and occupied regions in the diagram. - [GridRow Class](Markdown/T_MindFusion_Diagramming_GridRow.md): Represents a row in a (Markdown/T_MindFusion_Diagramming_GridPanel.md). - [GridStyle Enumeration](Markdown/CC_T_MindFusion_Diagramming_GridStyle_0.md): Defines values that specify the visual style of the alignment grid. - [HandlesStyle Enumeration](Markdown/T_MindFusion_Diagramming_HandlesStyle_0.md): Enumerates possible visual styles for frames and handles drawn around selected nodes. - [HandlesVisualStyle Class](Markdown/T_MindFusion_Diagramming_HandlesVisualStyle_1.md): Defines the pen and brush objects used to draw items' adjustment handles. - [HeaderEventArgs Class](Markdown/T_MindFusion_Diagramming_HeaderEventArgs.md): Contains the arguments passed to handlers of header-related events. - [HeaderResizeEventArgs Class](Markdown/T_MindFusion_Diagramming_HeaderResizeEventArgs.md): Contains the arguments passed to handlers of header resize events. - [InplaceEditEventArgs Class](Markdown/T_MindFusion_Diagramming_InplaceEditEventArgs.md): Contains the arguments passed to handlers of inplace edit related events. - [Interaction Class](Markdown/T_MindFusion_Diagramming_Interaction.md): Encapsulates the current state of user interaction with the control. - [InteractionState Class](Markdown/CC_T_MindFusion_Diagramming_InteractionState_0.md): Encapsulates the current state of user interaction with the control. - [ItemEventArgs Class](Markdown/T_MindFusion_Diagramming_ItemEventArgs_1.md): Contains the arguments passed to handlers of item-related events. - [ItemLabel Class](Markdown/T_MindFusion_Diagramming_ItemLabel.md): Represents a label displayed by a (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md). - [ItemListView Class](Markdown/T_MindFusion_Diagramming_ItemListView.md): A list view control that hosts (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md)s and supports drag-and-drop to (Markdown/T_MindFusion_Diagramming_DiagramView.md). - [LabelPosition Enumeration](Markdown/T_MindFusion_Diagramming_LabelPosition.md): Specifies the position of labels in a (Markdown/T_MindFusion_Diagramming_ListViewBase.md) control. - [LengthType Enumeration](Markdown/T_MindFusion_Diagramming_LengthType.md): Indicates how (Markdown/T_MindFusion_Diagramming_GridPanel.md) determines dimensions of its rows and columns. - [LinkCrossingEventArgs Class](Markdown/T_MindFusion_Diagramming_LinkCrossingsEventArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#validatelinkcrossing) event. - [LinkCrossings Enumeration](Markdown/T_MindFusion_Diagramming_LinkCrossings_0.md): Defines values that indicate how to render link intersection points. - [LinkEventArgs Class](Markdown/CC_T_MindFusion_Diagramming_LinkEventArgs_0.md): Contains the arguments passed to handlers of link-related events. - [LinkLabel Class](Markdown/T_MindFusion_Diagramming_LinkLabel_0.md): Represents a label displayed by a (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md). New labels can be added to a link by calling its (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md#ad... - [LinkNodesBehavior Class](Markdown/T_MindFusion_Diagramming_LinkNodesBehavior.md): The base class for behavior types that allow drawing both nodes and links. - [LinkShape Enumeration](Markdown/T_MindFusion_Diagramming_LinkShape.md): Specifies available styles for the segments of links. - [LinkShapesBehavior Class](Markdown/T_MindFusion_Diagramming_LinkShapesBehavior.md): This class is used when view's (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) is set to (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md). - [LinkTextStyle Enumeration](Markdown/T_MindFusion_Diagramming_LinkTextStyle_0.md): Specifies the position and alignment of links' labels. - [LinkValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_LinkValidationEventArgs_1.md): Contains the arguments passed to handlers of link validation events. - [ListViewBase Class](Markdown/T_MindFusion_Diagramming_ListViewBase.md): The base class of (Markdown/T_MindFusion_Diagramming_ItemListView.md) and (Markdown/T_MindFusion_Diagramming_NodeListView.md) controls. - [MagnifyBehavior Class](Markdown/T_MindFusion_Diagramming_MagnifyBehavior_0.md): This class is used when view's (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) is set to (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md). - [Manipulator Class](Markdown/CC_T_MindFusion_Diagramming_Manipulator_0.md): Manipulator is an abstract base class which defines the behavior of miscellaneous UI widgets attached to nodes. - [MarkStyle Enumeration](Markdown/CC_T_MindFusion_Diagramming_MarkStyle_0.md): Specifies the visual style of anchor point marks. - [ModificationStart Enumeration](Markdown/T_MindFusion_Diagramming_ModificationStart_0.md): Specifies how the user can start modifying an item. - [ModifierKeyAction Enumeration](Markdown/T_MindFusion_Diagramming_ModifierKeyAction_0.md): Defines the actions that can be assigned to a modifier key such as CTRL or ALT. - [ModifierKeyActions Class](Markdown/T_MindFusion_Diagramming_ModifierKeyActions.md): Maps keyboard modifier keys to special actions in MindFusion.Diagramming such as panning and drawing selection rectangle. - [ModifyBehavior Class](Markdown/T_MindFusion_Diagramming_ModifyBehavior.md): This class is used when view's (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) is set to (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md). - [ModifyLinkController Class](Markdown/T_MindFusion_Diagramming_ModifyLinkController.md): A controller used to modify existing links in the diagram. - [ModifyNodeController Class](Markdown/T_MindFusion_Diagramming_ModifyNodeController.md): A controller used to modify existing nodes in the diagram. - [ModifySelectionController Class](Markdown/T_MindFusion_Diagramming_ModifySelectionController.md): A controller used to modify multiple selected items in the diagram. - [MouseButtonActions Enumeration](Markdown/T_MindFusion_Diagramming_MouseButtonActions_0.md): Specifies what actions can be associated with the middle and right mouse buttons. - [MouseInputDispatcher Class](Markdown/T_MindFusion_Diagramming_MouseInputDispatcher.md): Processes mouse events and dispatches them to controller objects appropriate for current context. - [MouseWheelAction Enumeration](Markdown/T_MindFusion_Diagramming_MouseWheelAction.md): Specifies the type of action performed when the user rotates the mouse wheel. - [MoveNodesBehavior Class](Markdown/T_MindFusion_Diagramming_MoveNodesBehavior.md): This class is used when view's (Markdown/T_MindFusion_Diagramming_DiagramView.md#behavior) is set to (Markdown/CC_T_MindFusion_Diagramming_Behavior_0.md). - [NodeConstraints Class](Markdown/T_MindFusion_Diagramming_NodeConstraints_1.md): Defines specific constraints that can be applied to the size and location of nodes. - [NodeEffect Class](Markdown/T_MindFusion_Diagramming_NodeEffect_1.md): Represents the base class of all visual effects that can be applied to the nodes in a (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md). - [NodeEventArgs Class](Markdown/CC_T_MindFusion_Diagramming_NodeEventArgs_0.md): Contains the arguments passed to handlers of node-related events. - [NodeLabel Class](Markdown/T_MindFusion_Diagramming_NodeLabel.md): Represents a supplementary label displayed by a (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md). New labels can be added to a node by calling its (Markdown/CC_T_MindFusion_Diagramming_Diagr... - [NodeListView Class](Markdown/T_MindFusion_Diagramming_NodeListView.md): A list view control that hosts (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md)s and supports drag-and-drop to (Markdown/T_MindFusion_Diagramming_DiagramView.md). - [Orientation Enumeration](Markdown/T_MindFusion_Diagramming_Orientation_1.md): Specifies the orientation of user interface elements. - [Overview Class](Markdown/T_MindFusion_Diagramming_Overview.md): The (Markdown/T_MindFusion_Diagramming_Overview.md) control provides a scaled-down view of (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) contents and allows scrolling and zooming a (Markdown/... - [PageContainerCommand Class](Markdown/T_MindFusion_Diagramming_PageContainerCommand.md): Implements page navigation of (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md). - [PagedContainerNode Class](Markdown/T_MindFusion_Diagramming_PagedContainerNode.md): A container that can arrange its children in pages. - [PanBehavior Class](Markdown/T_MindFusion_Diagramming_PanBehavior.md): Pans the diagram when the users drags the mouse. - [PanController Class](Markdown/T_MindFusion_Diagramming_PanController.md): A controller used to pan the (Markdown/T_MindFusion_Diagramming_DiagramView.md). - [Panel Class](Markdown/T_MindFusion_Diagramming_Panel.md): Represents layout containers in (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) visual tree. - [Path Class](Markdown/T_MindFusion_Diagramming_Path_0.md): Represents a sequence of connected (Markdown/CC_T_MindFusion_Diagramming_DiagramNode_0.md) and (Markdown/CC_T_MindFusion_Diagramming_DiagramLink_0.md) elements. - [PathFinder Class](Markdown/T_MindFusion_Diagramming_PathFinder_0.md): Provides methods that help you find paths and cycles in a graph. - [PatternRouter Class](Markdown/T_MindFusion_Diagramming_PatternRouter_0.md): Routes links by applying patterns of segment and turn sequences and accepting them when resulting paths do not cross nodes. - [RelativeToLink Enumeration](Markdown/T_MindFusion_Diagramming_RelativeToLink_0.md): Specifies how the link labels are positioned. - [RelativeToNode Enumeration](Markdown/T_MindFusion_Diagramming_RelativeToNode.md): Specifies how the node labels are positioned. - [RemoveItemCommand Class](Markdown/T_MindFusion_Diagramming_RemoveItemCommand.md): Implements deletion of diagram items. - [ResizeTableColumnCommand Class](Markdown/T_MindFusion_Diagramming_ResizeTableColumnCommand.md): Implements resizing of table's columns. - [ResizeTableRowCommand Class](Markdown/T_MindFusion_Diagramming_ResizeTableRowCommand.md): Implements resizing of table's rows. - [RoutePattern Class](Markdown/T_MindFusion_Diagramming_RoutePattern_0.md): Represents a template from which routes are created. - [Router Class](Markdown/T_MindFusion_Diagramming_Router.md): Implements a simple link routing algorithm that pulls link segments out of nodes they would overlap. - [RouteStep Class](Markdown/T_MindFusion_Diagramming_RouteStep_0.md): Represents segments or turns in routing patterns. - [RouteStepKind Enumeration](Markdown/T_MindFusion_Diagramming_RouteStepKind_0.md): Represents parts of a route template. - [Ruler Class](Markdown/T_MindFusion_Diagramming_Ruler_0.md): The (Markdown/T_MindFusion_Diagramming_Ruler_0.md) control provides horizontal and vertical scales that help users measure and align diagram items. - [SaveToStringFormat Enumeration](Markdown/T_MindFusion_Diagramming_SaveToStringFormat_1.md): Specifies in what format to save the diagram when generating a string using the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md#savetostring) method. - [ScaleMode Enumeration](Markdown/T_MindFusion_Diagramming_ScaleMode.md): Defines (Markdown/T_MindFusion_Diagramming_Overview.md) scaling modes. - [ScrollTableCommand Class](Markdown/T_MindFusion_Diagramming_ScrollTableCommand.md): Handles undo / redo of table scrolling. - [Selection Class](Markdown/CC_T_MindFusion_Diagramming_Selection_0.md): Represents a set of items selected in the (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) document. - [SelectionChangedEventArgs Class](Markdown/T_MindFusion_Diagramming_SelectionChangedEventArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#selectionchanged) event. - [SelectionEventArgs Class](Markdown/T_MindFusion_Diagramming_SelectionEventArgs.md): Contains the arguments passed to handlers of selection-related events. - [SelectOnlyBehavior Class](Markdown/T_MindFusion_Diagramming_SelectOnlyBehavior_0.md): Allows only selection of existing items. Modifying them or drawing new ones is disabled. - [SerializeTagEventArgs Class](Markdown/T_MindFusion_Diagramming_SerializeTagEventArgs_0.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#serializetag) and (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#deserializetag) event handlers. - [ShadowsStyle Enumeration](Markdown/T_MindFusion_Diagramming_ShadowsStyle_0.md): Enumerates possible shadows-drawing styles. - [Shape Class](Markdown/CC_T_MindFusion_Diagramming_Shape_0.md): An instance of this class represents a shape defined through a series of arc, line and Bezier segments. The segments can be a part of the shape outline, in which case they define the part of the sh... - [ShapeDecoration Class](Markdown/T_MindFusion_Diagramming_ShapeDecoration_1.md): An instance of this class represents a child decoration figure of (#define-shape-geometries). - [ShapeElement Class](Markdown/T_MindFusion_Diagramming_ShapeElement.md): An instance of this class represents an element of (#define-shape-geometries), such as line segment, arc or Bezier curve. - [ShapeLibrary Class](Markdown/T_MindFusion_Diagramming_ShapeLibrary_0.md): The (Markdown/T_MindFusion_Diagramming_ShapeLibrary_0.md) class represents a collection of shape definitions stored together. - [ShapeNode Class](Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md): (Markdown/CC_T_MindFusion_Diagramming_ShapeNode_0.md) instances are diagram nodes that represent geometric shapes. - [Shapes Class](Markdown/CC_T_MindFusion_Diagramming_Shapes_0.md): Provides alternative methods of access to the predefined shapes. - [ShowAnchors Enumeration](Markdown/CC_T_MindFusion_Diagramming_ShowAnchors_0.md): Specifies when anchor points should be displayed. - [SimplePanel Class](Markdown/T_MindFusion_Diagramming_SimplePanel.md): A layout container that arranges its child components on top of each other. - [SimpleShape Enumeration](Markdown/T_MindFusion_Diagramming_SimpleShape_0.md): Defines the possible values for (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md#shape) property of tables and containers. - [SinglePointerController Class](Markdown/T_MindFusion_Diagramming_SinglePointerController.md): Processes mouse or single-touch events targeting a diagram element. - [StackPanel Class](Markdown/T_MindFusion_Diagramming_StackPanel.md): A layout container that arranges its child components stacked horizontally or vertically. - [Style Class](Markdown/CC_T_MindFusion_Diagramming_Style_0.md): Represents a set of appearance properties whose values can be inherited from parent objects if not set locally for an item. - [SvgContent Class](Markdown/T_MindFusion_Diagramming_SvgContent.md): (Markdown/T_MindFusion_Diagramming_SvgContent.md) represents the markup code of an SVG drawing. - [SvgExporter Class](Markdown/T_MindFusion_Diagramming_SvgExporter.md): Creates SVG (Scalable Vector Graphics) drawings from the content of (Markdown/CC_T_MindFusion_Diagramming_Diagram_0.md) objects. - [SvgNode Class](Markdown/T_MindFusion_Diagramming_SvgNode_0.md): (Markdown/T_MindFusion_Diagramming_SvgNode_0.md) instances are diagram nodes that can render SVG drawings. - [TableColumn Class](Markdown/T_MindFusion_Diagramming_TableColumn.md): Represents a column of a (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md). - [TableConnectionPoint Class](Markdown/T_MindFusion_Diagramming_TableConnectionPoint.md): A class that represents a connection between an edge and a node in a graph. - [TableNode Class](Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md): (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md) instances are diagram nodes that can be used to display tabular or list data. - [TableRow Class](Markdown/T_MindFusion_Diagramming_TableRow.md): Represents a row of a (Markdown/CC_T_MindFusion_Diagramming_TableNode_0.md). - [Theme Class](Markdown/CC_T_MindFusion_Diagramming_Theme_0.md): Represents a set of (Markdown/CC_T_MindFusion_Diagramming_Style_0.md) objects whose properties are used to render items of a specific type in the current diagram. - [TreeItemEventArgs Class](Markdown/T_MindFusion_Diagramming_TreeItemEventArgs_0.md): Contains the arguments passed to handlers of tree view items -related events. - [TreeViewConnectionPoint Class](Markdown/T_MindFusion_Diagramming_TreeViewConnectionPoint_1.md): A class that represents a connection between an edge and a node in a graph. - [TreeViewItem Class](Markdown/T_MindFusion_Diagramming_TreeViewItem_1.md): Represents a constituent item of the hierarchy displayed inside a (Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md). - [TreeViewNode Class](Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md): (Markdown/T_MindFusion_Diagramming_TreeViewNode_1.md) instances are diagram nodes that can draw hierarchical data. - [UndoEventArgs Class](Markdown/T_MindFusion_Diagramming_UndoEventArgs_2.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#actionundone) and (Markdown/T_MindFusion_Diagramming_DiagramBase_1.md#actionredone) event handlers. - [VideoNode Class](Markdown/T_MindFusion_Diagramming_VideoNode.md): A (Markdown/T_MindFusion_Diagramming_VideoNode.md) instance renders video stream assigned to the (Markdown/T_MindFusion_Diagramming_VideoNode.md#videolocation) property. - [WebComponents Class](Markdown/T_MindFusion_Diagramming_WebComponents.md): Implements registration of web components. - [XmlPersistContext Class](Markdown/T_MindFusion_Diagramming_XmlPersistContext_0.md): Contains helper methods for serialization of diagram contents to and from XML documents. ### Namespace MindFusion.Diagramming.Animations - [BounceAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_BounceAnimation_0.md): Animates vertical position of nodes. - [FillColorAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_FillColorAnimation_0.md): Animates the fill color of nodes or link arrowheads. - [ItemAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_ItemAnimation_0.md): Base class of diagram item animations. - [OpacityAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_OpacityAnimation_0.md): Animates items' opacity for fade-in and fade-out effects. - [PathAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_PathAnimation_0.md): Animates node positions along specified path. - [PulseAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_PulseAnimation_0.md): Animates node's local scale factor. - [ScrollAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_ScrollAnimation.md): Animates the scroll position of a diagram view. - [ShakeAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_ShakeAnimation_0.md): Animates horizontal position of nodes. - [StrokeColorAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_StrokeColorAnimation_0.md): Animates the color of node borders or link segments. - [ViewAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_ViewAnimation.md): Base class of diagram view animations. - [ZoomAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_ZoomAnimation.md): Animates the zoom level of a diagram view. ### Namespace MindFusion.Diagramming.Controls - [Events Class](Markdown/T_MindFusion_Diagramming_Controls_Events.md): Defines all events raised by the controls in the MindFusion.Diagrammming.Controls namespace. - [PageEventArgs Class](Markdown/T_MindFusion_Diagramming_Controls_PageEventArgs.md): Contains the arguments passed to handlers of page-related events in a TabbedDiagramView. - [Palette Class](Markdown/T_MindFusion_Diagramming_Controls_Palette.md): Represents a tool palette control that displays (Markdown/CC_T_MindFusion_Diagramming_DiagramItem_0.md) objects grouped into categories. Items from the palette can be added to a diagram by drag-and... - [ShapeDesigner Class](Markdown/T_MindFusion_Diagramming_Controls_ShapeDesigner.md): Represents an interactive vector-drawing control that can be used to design node shapes. - [TabAlignment Enumeration](Markdown/T_MindFusion_Diagramming_Controls_TabAlignment.md): Specifies the alignment of a tab strip relative to its container control. - [TabbedDiagramView Class](Markdown/T_MindFusion_Diagramming_Controls_TabbedDiagramView.md): Represents a view that displays (Markdown/T_MindFusion_Diagramming_DiagramDocument_1.md) objects. - [WebComponents Class](Markdown/T_MindFusion_Diagramming_Controls_WebComponents.md): Implements registration of web components. ### Namespace MindFusion.Diagramming.Lanes - [Cell Class](Markdown/T_MindFusion_Diagramming_Lanes_Cell.md): Represents a single cell in a lane grid. - [Grid Class](Markdown/T_MindFusion_Diagramming_Lanes_Grid_0.md): Represents a lane grid. - [Header Class](Markdown/T_MindFusion_Diagramming_Lanes_Header_0.md): Represents a header in a lane grid. - [ResizeType Enumeration](Markdown/T_MindFusion_Diagramming_Lanes_ResizeType_0.md): Specifies how to resize child columns and rows in the lanes grid when their parent column or row is resized. - [Style Class](Markdown/T_MindFusion_Diagramming_Lanes_Style_0.md): Encapsulates the appearance properties of an element in a lane grid. ### Namespace MindFusion.Drawing - [Alignment Enumeration](Markdown/T_MindFusion_Drawing_Alignment.md): Specifies the alignment of a graphics element relative to its layout rectangle. - [Border3D Class](Markdown/T_MindFusion_Drawing_Border3D.md): Represents a 3D border. - [Component Class](Markdown/T_MindFusion_Drawing_Component.md): Represents components in (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) visual tree. - [ComponentBase Class](Markdown/T_MindFusion_Drawing_ComponentBase.md): A base class for components in (Markdown/T_MindFusion_Diagramming_CompositeNode_0.md) visual tree. - [Container Class](Markdown/T_MindFusion_Drawing_Container.md): Represents container components in drawing tree. - [DashStyle Enumeration](Markdown/T_MindFusion_Drawing_DashStyle_3.md): Specifies the dash pattern of lines. - [DrawingUtils Class](Markdown/T_MindFusion_Drawing_DrawingUtils.md): Contains drawing-related helper functions. - [Ellipse Class](Markdown/T_MindFusion_Drawing_Ellipse.md): Represents an Ellipse. - [Font Class](Markdown/T_MindFusion_Drawing_Font.md): Represents a font. - [FontStyle Enumeration](Markdown/T_MindFusion_Drawing_FontStyle_0.md): Specifies font style attributes. - [GraphicsUnit Class](Markdown/T_MindFusion_Drawing_GraphicsUnit.md): Specifies the unit of measure for length and size properties. - [Image Class](Markdown/T_MindFusion_Drawing_Image.md): Represents an image. - [ImageAlign Enumeration](Markdown/T_MindFusion_Drawing_ImageAlign_0.md): Specifies the position and alignment of a picture in a node, or that of the background image. - [LayoutAlignment Enumeration](Markdown/T_MindFusion_Drawing_LayoutAlignment.md): Specifies alignment of components. - [LineJoin Enumeration](Markdown/T_MindFusion_Drawing_LineJoin_0.md): Specifies how to join consecutive line or curve segments in a figure. - [Path Class](Markdown/T_MindFusion_Drawing_Path.md): Represents a path. - [Point Class](Markdown/T_MindFusion_Drawing_Point.md): Represents a point. - [Rect Class](Markdown/T_MindFusion_Drawing_Rect.md): Represents a rectangle. - [Size Class](Markdown/T_MindFusion_Drawing_Size.md): Represents the size of 2D object. - [StringAlignment Enumeration](Markdown/T_MindFusion_Drawing_StringAlignment.md): Specifies the alignment of a text string relative to its layout rectangle. - [StringFormat Class](Markdown/T_MindFusion_Drawing_StringFormat_2.md): Encapsulates text layout information. - [Text Class](Markdown/T_MindFusion_Drawing_Text.md): Represents a text container. - [Thickness Class](Markdown/T_MindFusion_Drawing_Thickness.md): Describes the thickness of a rectangular frame. - [Vector Class](Markdown/T_MindFusion_Drawing_Vector.md): Represents displacement in 2D space. - [Video Class](Markdown/T_MindFusion_Drawing_Video.md): A component that displays video stream. - [Visibility Enumeration](Markdown/T_MindFusion_Drawing_Visibility.md): Specifies visibility for components. ### Namespace MindFusion.Graphs - [Anchoring Enumeration](Markdown/T_MindFusion_Graphs_Anchoring.md): Defines values that specify how automatic layout algorithms align links to anchor points. - [AssistantPosition Enumeration](Markdown/T_MindFusion_Graphs_AssistantPosition.md): Specifies the final position of an assistant node. Assistants with type left or right are always positioned to the left or right respectively. The position of the "normal" assistants depends on the... - [AssistantType Enumeration](Markdown/T_MindFusion_Graphs_AssistantType.md): Indicates the type of an assistant node in a tree. - [BorderedTreeLayout Class](Markdown/T_MindFusion_Graphs_BorderedTreeLayout.md): Implements algorithms for arranging tree structures. - [Edge Class](Markdown/T_MindFusion_Graphs_Edge.md): Represents an edge connecting two vertices in a graph. - [FlowchartLayout Class](Markdown/T_MindFusion_Graphs_FlowchartLayout.md): (Markdown/T_MindFusion_Graphs_FlowchartLayout.md) can be used to arrange flowcharts representing program source code. - [FractalLayout Class](Markdown/T_MindFusion_Graphs_FractalLayout.md): The FractalLayout tree layout algorithm places child nodes symmetrically around their parent node. Nodes at the lowest level are arranged directly in a circle around their parent. At the upper leve... - [Graph Class](Markdown/T_MindFusion_Graphs_Graph.md): Represents a graph. - [GridLayout Class](Markdown/T_MindFusion_Graphs_GridLayout.md): Implements a grid graph layout algorithm. - [LayeredLayout Class](Markdown/T_MindFusion_Graphs_LayeredLayout.md): Implements a layered graph layout algorithm. - [Layout Class](Markdown/T_MindFusion_Graphs_Layout.md): Superclass of graph layout algorithms that defines their common properties. - [LayoutDirection Enumeration](Markdown/T_MindFusion_Graphs_LayoutDirection.md): Specifies in what direction to place nodes processed by a layout algorithm. - [MultipleGraphsPlacement Enumeration](Markdown/T_MindFusion_Graphs_MultipleGraphsPlacement.md): Specifies placement of graph connected components relatively to each other. - [Orientation Enumeration](Markdown/T_MindFusion_Graphs_Orientation.md): Specifies general layout orientation. - [OrthogonalLayout Class](Markdown/T_MindFusion_Graphs_OrthogonalLayout.md): Implements orthogonal graph layout algorithm.Each link is drawn as a chain of alternating horizontal and vertical segments.Nodes are placed in a way that facilitates few links bends and crossings. - [Path Class](Markdown/T_MindFusion_Graphs_Path.md): Initializes a new instance of the Path class. - [PathFinder Class](Markdown/T_MindFusion_Graphs_PathFinder.md): Initializes a new instance of the PathFinder class. - [RadialTreeLayout Class](Markdown/T_MindFusion_Graphs_RadialTreeLayout.md): Implements a radial tree layout algorithm. - [SpringLayout Class](Markdown/T_MindFusion_Graphs_SpringLayout.md): Implements the Spring-Embedder graph layout algorithm. - [TopologicalLayout Class](Markdown/T_MindFusion_Graphs_TopologicalLayout.md): Applies topological ordering to the graph. This layout makes it easy to discern graph features such as overall flow direction, cycles and nested cycles. - [TreeLayout Class](Markdown/T_MindFusion_Graphs_TreeLayout.md): Implements algorithms for arranging tree structures. - [TreeLayoutLinkType Enumeration](Markdown/T_MindFusion_Graphs_TreeLayoutLinkType.md): Specifies the shape of the diagram links after they are laid out. - [TreeMapLayout Class](Markdown/T_MindFusion_Graphs_TreeMapLayout.md): Performs tree-map layout on a graph. - [Vertex Class](Markdown/T_MindFusion_Graphs_Vertex.md): Represents a vertex in a graph.