Implementing Diagrams with Syncfusion Vue
The Syncfusion Vue Diagram component enables you to create interactive, customizable diagrams for visualizing complex processes, organizational hierarchies, workflows, and data relationships. From simple flowcharts to advanced BPMN diagrams and UML representations, the Diagram component provides comprehensive tools for visual communication.
When to Use This Skill
- Flowcharts & Process Diagrams — Visualize workflows, decision trees, or procedural flows
- Organizational Charts — Represent hierarchical structures with automatic layouts
- BPMN Workflows — Design business process models with activities, gateways, and events
- UML Diagrams — Create class diagrams, sequence diagrams, and structured relationships
- Mind Maps & Radial Trees — Organize ideas and concepts hierarchically
- Swimlane Diagrams — Show processes across multiple actors or departments
- Custom Shapes & Connectors — Build tailored diagrams with styled nodes and labeled connections
- Interactive Visualization — Enable drag-drop, selection, pan/zoom, and user interaction
Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation and npm packages (Vue 2/3/Next.js/Preact)
- Project setup with Vite/CRA
- CSS imports and theme configuration
- Basic DiagramComponent usage
- Module injection basics
Core Elements: Nodes
📄 Read: references/nodes.md
- Creating and adding nodes to diagrams
- Node positioning (offsetX/Y, width/height)
- Node shape types (Flow, Basic, Path)
- Styling nodes (fill, stroke, opacity, shadows)
- Node customization and templates
- Expand/collapse functionality
- Node events and callbacks
Core Elements: Connectors
📄 Read: references/connectors.md
- Connector types (Straight, Orthogonal, Bezier)
- Segment configuration and routing
- Connecting nodes via sourceID/targetID
- Advanced segments and bezier curves
- Connector customization and styling
- Connector events and interaction
Annotations: Labels & Text
📄 Read: references/labels-and-annotations.md
- Adding labels to nodes and connectors
- Label styling (font, color, alignment, rotation)
- Label interaction (edit, drag, resize)
- Label positioning and offset
- Label events
Connection Points: Ports
📄 Read: references/ports.md
- Port types and connection points on nodes
- Port positioning and visibility
- Port appearance and styling
- Connecting connectors to specific ports
- Port interaction and events
Shapes & Visual Styling
📄 Read: references/shapes-and-styles.md
- Built-in shape types (Flow, Basic, Path, Image, HTML)
- Flow chart shape reference
- Style properties (fill, stroke, dash, shadow)
- CSS class customization
- Theme integration
BPMN Diagrams
📄 Read: references/bpmn-diagrams.md
- BPMN module injection and setup
- BPMN shape overview and types
- Activities (task, subprocess, expanded subprocess)
- Events (start, end, intermediate)
- Gateways (exclusive, parallel, inclusive)
- Flows (sequence, message, association)
- Data objects and data sources
- Groups and text annotations
UML Diagrams
📄 Read: references/uml-diagrams.md
- UML class diagrams
- Classifier shapes (class, interface, enumeration)
- UML relationships and associations
- UML sequence diagram elements and participants
- Participant stereotypes (Actor, Boundary, Control, Entity, Database, Default)
- Message types (Synchronous, Asynchronous, Reply, Create, Delete, Self)
- Activation boxes and lifelines
- Complete workflow examples
Entity Relationship Diagrams
📄 Read: references/implementing-entity-relationship-diagrams.md
- Entity Relationship (ER) diagram concepts and models
- ER shape configuration with fields and properties
- Field constraints (NotNull, Unique, Primary Key, Foreign Key)
- Relationship types and multiplicities (One, OneAndOnlyOne, Many, ZeroOrOne, OneOrMany, ZeroOrMany)
- ER connectors and relationship configuration
- Runtime field management and manipulation
Automatic Layouts
📄 Read: references/layouts.md
- Hierarchical tree layout
- Organizational chart layout
- Mindmap layout
- Radial tree layout
- Flowchart layout
- Complex hierarchical configurations
- Layout customization and spacing
- Layout events and callbacks
Swimlanes & Phases
📄 Read: references/swimlanes.md
- Swimlane structure and overview
- Creating lanes and phases
- Swimlane children and header configuration
- Swimlane palette
- Swimlane interaction
Grouping & Containers
📄 Read: references/groups-and-containers.md
- Grouping nodes together
- Group operations (add/remove children)
- Container nodes and nesting
- Padding and layout within containers
Symbol Palette
📄 Read: references/symbol-palette.md
- SymbolPaletteComponent setup
- Defining palette symbols
- Drag & drop to diagram
- Palette customization (icons, search, size)
- Palette events and interactions
Data Binding
📄 Read: references/data-binding.md
- DataManager and dataSourceSettings
- id/parentId mapping for hierarchies
- Rendering org-charts from JSON data
- Remote data via DataManager (OData/Web API/REST)
- setNodeTemplate for data-driven rendering
Interaction & Tools
📄 Read: references/interaction-and-tools.md
- Selection, drag, resize interactions
- Tool modes (pointer, draw, pan)
- Constraints (node, connector, diagram)
- Commands and keyboard shortcuts
- Undo/Redo functionality
- Context menus
- User handles
Serialization & Export
📄 Read: references/serialization-and-export.md
- Save/load diagrams as JSON
- Export to image (PNG, SVG, JPG) — use
exportDiagram (inject PrintAndExport)
- Print functionality
- Visio file import/export (experimental; inject ImportAndExportVisio)
- Mermaid syntax support with
saveDiagramAsMermaid() and loadDiagramFromMermaid()
- Change detection with
isModified property for unsaved changes tracking
- EJ1 migration serialization
Diagram Settings & Configuration
📄 Read: references/diagram-settings.md
- Layers (add, lock, visibility, selection)
- Virtualization (performance optimization)
- Grid lines (snapping, dots/lines)
- Ruler (horizontal/vertical)
- Scroll settings
- Page settings (size, orientation, margins)
- Tooltip configuration
- Overview panel
- Localization and accessibility
Quick Start
<template>
<div id="app">
<ejs-diagram
id="diagram"
:width="width"
:height="height"
:nodes="nodes"
:connectors="connectors"
:snapSettings="snapSettings"
></ejs-diagram>
</div>
</template>
<script>
import { DiagramComponent,SnapConstraints } from '@syncfusion/ej2-vue-diagrams';
export default {
name: "App",
components: {
"ejs-diagram": DiagramComponent
},
data() {
return {
width: "100%",
height: "590px",
nodes: [
{
id: 'node1',
width: 100,
height: 100,
offsetX: 250,
offsetY: 250,
style: { fill: '#6BA3D5' },
annotations: [{ content: 'Node 1' }]
},
{
id: 'node2',
width: 100,
height: 100,
offsetX: 450,
offsetY: 250,
style: { fill: '#6BA3D5' },
annotations: [{ content: 'Node 2' }]
}
],
connectors: [
{
id: 'connector1',
sourceID: 'node1',
targetID: 'node2',
type: 'Orthogonal'
}
],
snapSettings: {
constraints: SnapConstraints.None
}
}
}
}
</script>
<style>
@import '../node_modules/@syncfusion/ej2-vue-diagrams/styles/material.css';
</style>
Vue 2 vs Vue 3 Decision Guide
⚠️ CRITICAL: Syncfusion Diagram works with both Vue 2 and Vue 3, but patterns differ significantly.
Quick Decision Tree
┌─ Do you have an existing Vue project?
│
├─ YES, it's Vue 3 (Vite, create-vue, etc.)
│ └─ Use: Composition API with <script setup>
│ ✅ Modern, performant, recommended
│ 📄 Read: getting-started.md (Vue 3 Composition API section)
│
├─ YES, it's Vue 2 (Vue CLI, legacy projects)
│ └─ Use: Options API with export default
│ ✅ Compatible, but consider migrating
│ 📄 Read: getting-started.md (Vue 2 section)
│
└─ NO, starting fresh
└─ Recommended: Vue 3 with Vite
✅ Fastest, most modern
📄 Read: getting-started.md (Vite + Vue 3 setup)
Version Signatures
Vue 3 Composition API (Recommended):
import { ref } from 'vue';
import { DiagramComponent } from '@syncfusion/ej2-vue-diagrams';
const nodes = ref([...]); // ← Use ref()
Vue 2 Options API:
import { DiagramComponent } from '@syncfusion/ej2-vue-diagrams';
export default {
data() {
return {
nodes: [...] // ← Use data()
}
}
}
⚡ Pro Tip: If you're unsure, default to Vue 3 Composition API—it's the industry standard for new Syncfusion projects.
Common Patterns
Pattern 1: Creating Flowchart with Auto Layout
// Use hierarchical layout with nodes and connectors
const layout = {
type: 'HierarchicalTree',
orientation: 'TopToBottom',
horizontalSpacing: 50,
verticalSpacing: 50,
getLayoutInfo: (node, options) => {
// Customize layout per node
}
};
diagram.layout = layout;
diagram.doLayout();
Pattern 2: Data-Driven Organization Chart
// Render org chart from JSON data with DataManager
const dataSettings = {
id: 'id',
parentId: 'manager',
dataSource: new DataManager(employeeData)
};
diagram.dataSourceSettings = dataSettings;
Pattern 3: Interactive Node Selection
// Handle node selection events
diagram.selectionChange = (args) => {
console.log('Selected:', args.newItems);
};
// In Vue: bind the selectionChange event and read newValue/oldValue
// <ejs-Diagram :selectionChange="onSelectionChange" ... />
const => {
console.log('Selected:', args.newItems);
};
Pattern 4: Export & Persistence (Advanced)
// Save state and export
const jsonData = diagram.saveDiagram();
localStorage.setItem('diagram', jsonData);
// Later: Load from storage
const saved = localStorage.getItem('diagram');
diagram.loadDiagram(saved);
// Export as PNG
diagram.export({ format: 'PNG', fileName: 'diagram' });
Key Props
| Prop |
Type |
Purpose |
nodes |
Array |
Collection of diagram nodes |
connectors |
Array |
Collection of connectors linking nodes |
layout |
Object |
Automatic layout configuration |
dataSourceSettings |
Object |
Data binding and source configuration |
snapSettings |
Object |
Snap constraints and guidelines |
pageSettings |
Object |
Page size, orientation, margins |
scrollSettings |
Object |
Pan and scroll behavior |
constraints |
Object |
Diagram-level interaction constraints |
contextMenuSettings |
Object |
Right-click menu configuration |
undoRedoSettings |
Object |
Undo/redo behavior |
Related Skills
- BPMN process modeling with Syncfusion workflows
- Data visualization layouts and hierarchies
- Interactive flowchart design
1---2name: syncfusion-vue-diagram3description: Build interactive diagrams using Syncfusion Vue Diagram, including flowcharts, BPMN workflows, UML diagrams, Entity Relationship (ER) diagrams, swimlanes, and organizational charts. Trigger when working with Vue diagram components such as nodes, connectors, shapes, ports, labels, layouts, symbol palettes, serialization/deserialization with unsaved changes detection, Mermaid syntax support, data binding, interactive editing, and exporting diagrams for visualization and process flows.4---56# Implementing Diagrams with Syncfusion Vue78The Syncfusion Vue Diagram component enables you to create interactive, customizable diagrams for visualizing complex processes, organizational hierarchies, workflows, and data relationships. From simple flowcharts to advanced BPMN diagrams and UML representations, the Diagram component provides comprehensive tools for visual communication.910## When to Use This Skill1112- **Flowcharts & Process Diagrams** — Visualize workflows, decision trees, or procedural flows13- **Organizational Charts** — Represent hierarchical structures with automatic layouts14- **BPMN Workflows** — Design business process models with activities, gateways, and events15- **UML Diagrams** — Create class diagrams, sequence diagrams, and structured relationships16- **Mind Maps & Radial Trees** — Organize ideas and concepts hierarchically17- **Swimlane Diagrams** — Show processes across multiple actors or departments18- **Custom Shapes & Connectors** — Build tailored diagrams with styled nodes and labeled connections19- **Interactive Visualization** — Enable drag-drop, selection, pan/zoom, and user interaction2021## Navigation Guide2223### Getting Started24📄 **Read:** [references/getting-started.md](references/getting-started.md)25- Installation and npm packages (Vue 2/3/Next.js/Preact)26- Project setup with Vite/CRA27- CSS imports and theme configuration28- Basic DiagramComponent usage29- Module injection basics3031### Core Elements: Nodes32📄 **Read:** [references/nodes.md](references/nodes.md)33- Creating and adding nodes to diagrams34- Node positioning (offsetX/Y, width/height)35- Node shape types (Flow, Basic, Path)36- Styling nodes (fill, stroke, opacity, shadows)37- Node customization and templates38- Expand/collapse functionality39- Node events and callbacks4041### Core Elements: Connectors42📄 **Read:** [references/connectors.md](references/connectors.md)43- Connector types (Straight, Orthogonal, Bezier)44- Segment configuration and routing45- Connecting nodes via sourceID/targetID46- Advanced segments and bezier curves47- Connector customization and styling48- Connector events and interaction4950### Annotations: Labels & Text51📄 **Read:** [references/labels-and-annotations.md](references/labels-and-annotations.md)52- Adding labels to nodes and connectors53- Label styling (font, color, alignment, rotation)54- Label interaction (edit, drag, resize)55- Label positioning and offset56- Label events5758### Connection Points: Ports59📄 **Read:** [references/ports.md](references/ports.md)60- Port types and connection points on nodes61- Port positioning and visibility62- Port appearance and styling63- Connecting connectors to specific ports64- Port interaction and events6566### Shapes & Visual Styling67📄 **Read:** [references/shapes-and-styles.md](references/shapes-and-styles.md)68- Built-in shape types (Flow, Basic, Path, Image, HTML)69- Flow chart shape reference70- Style properties (fill, stroke, dash, shadow)71- CSS class customization72- Theme integration7374### BPMN Diagrams75📄 **Read:** [references/bpmn-diagrams.md](references/bpmn-diagrams.md)76- BPMN module injection and setup77- BPMN shape overview and types78- Activities (task, subprocess, expanded subprocess)79- Events (start, end, intermediate)80- Gateways (exclusive, parallel, inclusive)81- Flows (sequence, message, association)82- Data objects and data sources83- Groups and text annotations8485### UML Diagrams86📄 **Read:** [references/uml-diagrams.md](references/uml-diagrams.md)87- UML class diagrams88- Classifier shapes (class, interface, enumeration)89- UML relationships and associations90- UML sequence diagram elements and participants91- Participant stereotypes (Actor, Boundary, Control, Entity, Database, Default)92- Message types (Synchronous, Asynchronous, Reply, Create, Delete, Self)93- Activation boxes and lifelines94- Complete workflow examples9596### Entity Relationship Diagrams97📄 **Read:** [references/implementing-entity-relationship-diagrams.md](references/entity-relationship-diagrams.md)98- Entity Relationship (ER) diagram concepts and models99- ER shape configuration with fields and properties100- Field constraints (NotNull, Unique, Primary Key, Foreign Key)101- Relationship types and multiplicities (One, OneAndOnlyOne, Many, ZeroOrOne, OneOrMany, ZeroOrMany)102- ER connectors and relationship configuration103- Runtime field management and manipulation104105### Automatic Layouts106📄 **Read:** [references/layouts.md](references/layouts.md)107- Hierarchical tree layout108- Organizational chart layout109- Mindmap layout110- Radial tree layout111- Flowchart layout112- Complex hierarchical configurations113- Layout customization and spacing114- Layout events and callbacks115116### Swimlanes & Phases117📄 **Read:** [references/swimlanes.md](references/swimlanes.md)118- Swimlane structure and overview119- Creating lanes and phases120- Swimlane children and header configuration121- Swimlane palette122- Swimlane interaction123124### Grouping & Containers125📄 **Read:** [references/groups-and-containers.md](references/groups-and-containers.md)126- Grouping nodes together127- Group operations (add/remove children)128- Container nodes and nesting129- Padding and layout within containers130131### Symbol Palette132📄 **Read:** [references/symbol-palette.md](references/symbol-palette.md)133- SymbolPaletteComponent setup134- Defining palette symbols135- Drag & drop to diagram136- Palette customization (icons, search, size)137- Palette events and interactions138139### Data Binding140📄 **Read:** [references/data-binding.md](references/data-binding.md)141- DataManager and dataSourceSettings142- id/parentId mapping for hierarchies143- Rendering org-charts from JSON data144- Remote data via DataManager (OData/Web API/REST)145- setNodeTemplate for data-driven rendering146147### Interaction & Tools148📄 **Read:** [references/interaction-and-tools.md](references/interaction-and-tools.md)149- Selection, drag, resize interactions150- Tool modes (pointer, draw, pan)151- Constraints (node, connector, diagram)152- Commands and keyboard shortcuts153- Undo/Redo functionality154- Context menus155- User handles156157### Serialization & Export158📄 **Read:** [references/serialization-and-export.md](references/serialization-and-export.md)159- Save/load diagrams as JSON160- Export to image (PNG, SVG, JPG) — use `exportDiagram` (inject PrintAndExport)161- Print functionality162- Visio file import/export (experimental; inject ImportAndExportVisio)163- Mermaid syntax support with `saveDiagramAsMermaid()` and `loadDiagramFromMermaid()`164- Change detection with `isModified` property for unsaved changes tracking165- EJ1 migration serialization166167### Diagram Settings & Configuration168📄 **Read:** [references/diagram-settings.md](references/diagram-settings.md)169- Layers (add, lock, visibility, selection)170- Virtualization (performance optimization)171- Grid lines (snapping, dots/lines)172- Ruler (horizontal/vertical)173- Scroll settings174- Page settings (size, orientation, margins)175- Tooltip configuration176- Overview panel177- Localization and accessibility178179## Quick Start180181```vue182<template>183 <div id="app">184 <ejs-diagram 185 id="diagram"186 :width="width"187 :height="height"188 :nodes="nodes"189 :connectors="connectors"190 :snapSettings="snapSettings"191 ></ejs-diagram>192</div>193</template>194<script>195import { DiagramComponent,SnapConstraints } from '@syncfusion/ej2-vue-diagrams';196export default {197 name: "App",198 components: {199 "ejs-diagram": DiagramComponent200 },201 data() {202 return {203 width: "100%",204 height: "590px",205 nodes: [206 {207 id: 'node1',208 width: 100,209 height: 100,210 offsetX: 250,211 offsetY: 250,212 style: { fill: '#6BA3D5' },213 annotations: [{ content: 'Node 1' }]214 },215 {216 id: 'node2',217 width: 100,218 height: 100,219 offsetX: 450,220 offsetY: 250,221 style: { fill: '#6BA3D5' },222 annotations: [{ content: 'Node 2' }]223 }224 ],225 connectors: [226 {227 id: 'connector1',228 sourceID: 'node1',229 targetID: 'node2',230 type: 'Orthogonal'231 }232 ],233 snapSettings: {234 constraints: SnapConstraints.None235 }236 }237 }238}239</script>240241<style>242@import '../node_modules/@syncfusion/ej2-vue-diagrams/styles/material.css';243</style>244```245246## Vue 2 vs Vue 3 Decision Guide247248**⚠️ CRITICAL:** Syncfusion Diagram works with both Vue 2 and Vue 3, but patterns differ significantly.249250### Quick Decision Tree251252```253┌─ Do you have an existing Vue project?254│255├─ YES, it's Vue 3 (Vite, create-vue, etc.)256│ └─ Use: Composition API with <script setup>257│ ✅ Modern, performant, recommended258│ 📄 Read: getting-started.md (Vue 3 Composition API section)259│260├─ YES, it's Vue 2 (Vue CLI, legacy projects)261│ └─ Use: Options API with export default262│ ✅ Compatible, but consider migrating263│ 📄 Read: getting-started.md (Vue 2 section)264│265└─ NO, starting fresh266 └─ Recommended: Vue 3 with Vite267 ✅ Fastest, most modern268 📄 Read: getting-started.md (Vite + Vue 3 setup)269```270271### Version Signatures272273**Vue 3 Composition API (Recommended):**274```javascript275import { ref } from 'vue';276import { DiagramComponent } from '@syncfusion/ej2-vue-diagrams';277278const nodes = ref([...]); // ← Use ref()279```280281**Vue 2 Options API:**282```javascript283import { DiagramComponent } from '@syncfusion/ej2-vue-diagrams';284285export default {286 data() {287 return {288 nodes: [...] // ← Use data()289 }290 }291}292```293294**⚡ Pro Tip:** If you're unsure, default to Vue 3 Composition API—it's the industry standard for new Syncfusion projects.295296## Common Patterns297298### Pattern 1: Creating Flowchart with Auto Layout299```javascript300// Use hierarchical layout with nodes and connectors301const layout = {302 type: 'HierarchicalTree',303 orientation: 'TopToBottom',304 horizontalSpacing: 50,305 verticalSpacing: 50,306 getLayoutInfo: (node, options) => {307 // Customize layout per node308 }309};310diagram.layout = layout;311diagram.doLayout();312```313314### Pattern 2: Data-Driven Organization Chart315```javascript316// Render org chart from JSON data with DataManager317const dataSettings = {318 id: 'id',319 parentId: 'manager',320 dataSource: new DataManager(employeeData)321};322diagram.dataSourceSettings = dataSettings;323```324325### Pattern 3: Interactive Node Selection326```javascript327// Handle node selection events328diagram.selectionChange = (args) => {329 console.log('Selected:', args.newItems);330};331332// In Vue: bind the selectionChange event and read newValue/oldValue333// <ejs-Diagram :selectionChange="onSelectionChange" ... />334const onSelectionChange = (args) => {335 console.log('Selected:', args.newItems);336};337```338339### Pattern 4: Export & Persistence (Advanced)340```javascript341// Save state and export342const jsonData = diagram.saveDiagram();343localStorage.setItem('diagram', jsonData);344345// Later: Load from storage346const saved = localStorage.getItem('diagram');347diagram.loadDiagram(saved);348349// Export as PNG350diagram.export({ format: 'PNG', fileName: 'diagram' });351```352353## Key Props354355| Prop | Type | Purpose |356|------|------|---------|357| `nodes` | Array | Collection of diagram nodes |358| `connectors` | Array | Collection of connectors linking nodes |359| `layout` | Object | Automatic layout configuration |360| `dataSourceSettings` | Object | Data binding and source configuration |361| `snapSettings` | Object | Snap constraints and guidelines |362| `pageSettings` | Object | Page size, orientation, margins |363| `scrollSettings` | Object | Pan and scroll behavior |364| `constraints` | Object | Diagram-level interaction constraints |365| `contextMenuSettings` | Object | Right-click menu configuration |366| `undoRedoSettings` | Object | Undo/redo behavior |367368## Related Skills369370- BPMN process modeling with Syncfusion workflows371- Data visualization layouts and hierarchies372- Interactive flowchart design