Getting Started with Angular Diagram Component
25 Aug 202524 minutes to read
This section explains the steps required to create a simple diagram and demonstrates the basic usage of the diagram component.
Prerequisites
System requirements for Syncfusion Angular UI components
Dependencies
The following dependencies are required to use the Diagram
component in your application:
|-- @syncfusion/ej2-angular-diagrams
|-- @syncfusion/ej2-base
|-- @syncfusion/ej2-data
|-- @syncfusion/ej2-navigations
|-- @syncfusion/ej2-inputs
|-- @syncfusion/ej2-popups
|-- @syncfusion/ej2-buttons
|-- @syncfusion/ej2-lists
|-- @syncfusion/ej2-splitbuttons
Setup Angular Environment
Use Angular CLI to set up your Angular applications. Install Angular CLI using the following command:
npm install -g @angular/cli
Create an Angular Application
Start a new Angular application using below Angular CLI command.
ng new my-diagram-app
cd my-diagram-app
Installing Syncfusion Diagram package
All available Essential JS 2 packages are published in the npmjs.com registry.
To install the Diagram component, use the following command:
npm install @syncfusion/ej2-angular-diagrams --save
NOTE
The –save flag instructs NPM to include the diagram package in the dependencies section of the package.json file.
Registering Diagram Module
Import the Diagram module into your Angular application (app.component.ts) from the package @syncfusion/ej2-angular-diagrams
[src/app/app.component.ts].
import { DiagramModule } from '@syncfusion/ej2-angular-diagrams';
import { Component } from "@angular/core";
@Component({
//Import Diagram module
imports: [
DiagramModule
],
providers: [ ],
standalone: true,
selector: "app-container",
// specifies the template string for the diagram component
template: `<ejs-diagram id="diagram" width="100%" height="580px"></ejs-diagram>`,
})
export class AppComponent {}
Adding CSS reference
Combined CSS files are available in the Essential JS 2 package root folder. Reference these in your [src/styles.css] file using the following code:
@import '../node_modules/@syncfusion/ej2-angular-diagrams/styles/material.css';
@import "../node_modules/@syncfusion/ej2-angular-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
Add Diagram component
Modify the template in the [src/app/app.component.ts] file to render the diagram component. Add the Angular Diagram using the <ejs-diagram>
selector in the template
section of the app.component.ts file:
import { DiagramModule } from '@syncfusion/ej2-angular-diagrams';
import { Component } from "@angular/core";
@Component({
//Import Diagram module
imports: [
DiagramModule
],
providers: [ ],
standalone: true,
selector: "app-container",
// specifies the template string for the diagram component
template: `<ejs-diagram id="diagram" width="100%" height="580px"></ejs-diagram>`,
})
export class AppComponent {}
Module Injection
The diagram component is divided into individual feature-wise modules. To use a particular feature, inject the required module. The following list describes the module names and their descriptions:
-
BpmnDiagramsService
- Inject this provider to add built-in BPMN shapes to diagrams. -
ConnectorBridgingService
- Inject this provider to add bridges to connectors. -
ConnectorEditingService
- Inject this provider to edit connector segments. -
ComplexHierarchicalTreeService
- Inject this provider for complex hierarchical tree structures. -
DataBindingService
- Inject this provider to populate nodes from a given data source. -
DiagramContextMenuService
- Inject this provider to manipulate the context menu. -
HierarchicalTreeService
- Inject this provider to use hierarchical tree structures. -
LayoutAnimationService
- Inject this provider to add animation to layouts. -
MindMapService
- Inject this provider to use mind map layouts. -
PrintAndExportService
- Inject this provider to print or export diagram objects. -
RadialTreeService
- Inject this provider to use radial tree structures. -
SnappingService
- Inject this provider to enable object snapping. -
SymmetricLayoutService
- Inject this provider to render layouts in a symmetrical method. -
UndoRedoService
- Inject this provider to revert and restore changes. -
Ej1SerializationService
- Inject this provider to load EJ1 diagram JSON in EJ2 diagrams.
These modules should be injected into the providers section of the root NgModule or component class:
import { BpmnDiagramsService, ComplexHierarchicalTreeService, ConnectorBridgingService, ConnectorEditingService, DataBindingService, DiagramContextMenuService, DiagramModule, Ej1SerializationService, HierarchicalTreeService, LayoutAnimationService, MindMapService, PrintAndExportService, RadialTreeService, SnappingService, SymmetricLayoutService, UndoRedoService } from '@syncfusion/ej2-angular-diagrams';
import { Component } from "@angular/core";
@Component({
imports: [
DiagramModule
],
providers: [ HierarchicalTreeService, MindMapService, RadialTreeService, ComplexHierarchicalTreeService, DataBindingService, SnappingService, PrintAndExportService, BpmnDiagramsService, SymmetricLayoutService, ConnectorBridgingService, UndoRedoService, LayoutAnimationService, DiagramContextMenuService, ConnectorEditingService,Ej1SerializationService ],
standalone: true,
selector: "app-container",
// specifies the template string for the diagram component
template: `<ejs-diagram id="diagram" width="100%" height="400px"></ejs-diagram>`,
})
export class AppComponent {}
Defining Basic Diagram
The example below shows a basic diagram that renders an empty diagram canvas:
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { DiagramModule } from '@syncfusion/ej2-angular-diagrams'
import { Component } from "@angular/core";
@Component({
imports: [
DiagramModule
],
providers: [ ],
standalone: true,
selector: "app-container",
// specifies the template string for the diagram component
template: `<ejs-diagram id="diagram" width="100%" height="580px"></ejs-diagram>`
})
export class AppComponent {}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Now, run the application using the npm start command. Open the browser with the generated link and you can see an empty diagram:
npm start
NOTE
The selector specified in the @Component decorator of the app.component.ts file must match the custom element tag used in the index.html file. For example, if your @Component decorator includes the selector “app-container”, your index.html file should include an element
<app-container></app-container>
.
Basic Diagram elements
Diagrams are built using the following core elements:
-
Node
: Visualizes graphical objects that can be arranged and manipulated on a diagram page. -
Connector
: Represents relationships between two nodes. Three types of connectors are provided:- Orthogonal
- Bezier
- Straight
-
Port
: Acts as connection points on nodes or connectors, allowing connections only at specific points. -
Annotation
: Displays additional information by adding text or labels on nodes and connectors.
Flow Diagram
Create and Add Node to the diagram
Create and add a node
(JSON data) with specific position, size, label, and shape:
import { DiagramComponent, DiagramModule } from '@syncfusion/ej2-angular-diagrams'
import { Component, ViewEncapsulation, ViewChild } from "@angular/core";
@Component({
imports: [
DiagramModule
],
providers: [ ],
standalone: true,
selector: "app-container",
template: `<ejs-diagram id="diagram" width="100%" height="580px" mode="SVG">
<e-nodes>
<e-node id='node1' [height]=60 [width]=100 [offsetX]=300 [offsetY]=80 >
<e-node-annotations>
<e-node-annotation content='Start'></e-node-annotation>
</e-node-annotations>
</e-node>
</e-nodes>
</ejs-diagram>`,
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
@ViewChild("diagram")
public diagram?: DiagramComponent;
ngOnInit(): void {
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Apply shape and style to node
The Syncfusion diagram component provides support to render many built-in shapes. Refer to Shapes to learn about built-in shapes.
Customize the appearance of a node by changing its fill
color, strokeColor
, strokeWidth
, borderColor
, borderWidth
, strokeDashArray
, opacity
, and shadow
properties:
import { DiagramComponent, DiagramModule, FlowShapeModel } from '@syncfusion/ej2-angular-diagrams'
import { Component, ViewEncapsulation, ViewChild } from "@angular/core";
@Component({
imports: [
DiagramModule
],
providers: [ ],
standalone: true,
selector: "app-container",
template: `<ejs-diagram id="diagram" width="100%" height="580px" mode="SVG">
<e-nodes>
<e-node id='node1' [height]=60 [width]=100 [offsetX]=300 [offsetY]=80 [shape]='shape' [style]='style' [borderColor]='borderColor' [borderWidth]='borderWidth'>
<e-node-annotations>
<e-node-annotation content='Start'></e-node-annotation>
</e-node-annotations>
</e-node>
</e-nodes>
</ejs-diagram>`,
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
@ViewChild("diagram")
public Diagram?: DiagramComponent;
public shape:FlowShapeModel = { type: 'Flow', shape: 'Terminator'};
public borderColor = 'orange';
public borderWidth = 10;
public style = {fill:'red',strokeColor:'green',strokeWidth:5,strokeDashArray:'2 2'};
ngOnInit(): void {
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Add other flowchart nodes to the diagram
Add multiple nodes with different shapes to create a comprehensive diagram:
import { DiagramComponent, DiagramModule } from '@syncfusion/ej2-angular-diagrams'
import { Component, ViewEncapsulation, ViewChild } from "@angular/core";
import {
FlowShapeModel,
NodeModel,
ConnectorModel,
} from "@syncfusion/ej2-angular-diagrams";
@Component({
imports: [
DiagramModule
],
providers: [ ],
standalone: true,
selector: "app-container",
template: `<ejs-diagram id="diagram" width="100%" height="580px" [getNodeDefaults]='nodeDefaults' [getConnectorDefaults]='connectorDefaults'>
<e-nodes>
<e-node id='node1' [offsetX]=300 [offsetY]=50 [shape]='terminator'>
<e-node-annotations>
<e-node-annotation content='Start'></e-node-annotation>
</e-node-annotations>
</e-node>
<e-node id='node2' [offsetX]=300 [offsetY]=140 [shape]='process'>
<e-node-annotations>
<e-node-annotation content='var i = 0;'></e-node-annotation>
</e-node-annotations>
</e-node>
<e-node id='node3' [offsetX]=300 [offsetY]=230 [shape]='decision'>
<e-node-annotations>
<e-node-annotation content='i < 10?'></e-node-annotation>
</e-node-annotations>
</e-node>
</e-nodes>
</ejs-diagram>`,
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
@ViewChild("diagram")
public diagram?: DiagramComponent;
public terminator?: FlowShapeModel;
public process?: FlowShapeModel;
public decision?: FlowShapeModel;
public nodeDefaults(node: NodeModel): NodeModel {
node.height = 50;
node.width = 140;
node.style = {fill:'skyblue', strokeColor: 'skyblue'};
return node;
}
public connectorDefaults(obj: ConnectorModel): ConnectorModel {
obj.type = "Orthogonal";
obj.targetDecorator = { shape: "Arrow", width: 10, height: 10 };
return obj;
}
ngOnInit(): void {
this.terminator = { type: 'Flow', shape: 'Terminator' };
this.process = { type: 'Flow', shape: 'Process' };
this.decision = { type: 'Flow', shape: 'Decision' };
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Connect flow chart nodes
Connect nodes by adding connectors using the connectors
property of the diagram. Reference the source and target endpoints using the sourceID
and targetID
properties. Combine the required nodes and connectors to form a complete flow diagram:
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { DiagramComponent, DiagramModule } from '@syncfusion/ej2-angular-diagrams'
import { Component, ViewEncapsulation, ViewChild } from "@angular/core";
import {
FlowShapeModel,
NodeModel,
ConnectorModel,
OrthogonalSegmentModel
} from "@syncfusion/ej2-angular-diagrams";
@Component({
imports: [
DiagramModule
],
providers: [ ],
standalone: true,
selector: "app-container",
template: `<ejs-diagram id="diagram" width="100%" height="580px" [getNodeDefaults]='nodeDefaults' [getConnectorDefaults]='connectorDefaults'>
<e-nodes>
<e-node id='node1' [offsetX]=300 [offsetY]=50 [shape]='terminator'>
<e-node-annotations>
<e-node-annotation content='Start'></e-node-annotation>
</e-node-annotations>
</e-node>
<e-node id='node2' [offsetX]=300 [offsetY]=140 [shape]='process'>
<e-node-annotations>
<e-node-annotation content='var i = 0;'></e-node-annotation>
</e-node-annotations>
</e-node>
<e-node id='node3' [offsetX]=300 [offsetY]=230 [shape]='decision'>
<e-node-annotations>
<e-node-annotation content='i < 10?'></e-node-annotation>
</e-node-annotations>
</e-node>
<e-node id='node4' [offsetX]=100 [offsetY]=320 [shape]='preDefinedProcess'>
<e-node-annotations>
<e-node-annotation content='print(\"Hello!!\");'></e-node-annotation>
</e-node-annotations>
</e-node>
<e-node id='node5' [offsetX]=300 [offsetY]=410 [shape]='process'>
<e-node-annotations>
<e-node-annotation content='i++;'></e-node-annotation>
</e-node-annotations>
</e-node>
<e-node id='node6' [offsetX]=500 [offsetY]=500 [shape]='terminator'>
<e-node-annotations>
<e-node-annotation content='End'></e-node-annotation>
</e-node-annotations>
</e-node>
</e-nodes>
<e-connectors>
<e-connector id='connector1' sourceID='node1' targetID='node2'></e-connector>
<e-connector id='connector2' sourceID='node2' targetID='node3'></e-connector>
<e-connector id='connector3' sourceID='node3' targetID='node4'>
<e-connector-annotations>
<<e-connector-annotation content='Yes'></e-connector-annotation>
</e-connector-annotations>
</e-connector>
<e-connector id='connector4' sourceID='node3' targetID='node6' [segments]='segment1'>
<e-connector-annotations>
<e-connector-annotation content='No'></e-connector-annotation>
</e-connector-annotations>
</e-connector>
<e-connector id='connector5' sourceID='node4' targetID='node5'></e-connector>
<e-connector id='connector6' sourceID='node5' targetID='node3' [segments]='segment2'></e-connector>
</e-connectors>
</ejs-diagram>`,
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
@ViewChild("diagram")
public diagram?: DiagramComponent;
public terminator?: FlowShapeModel;
public process?: FlowShapeModel;
public decision?: FlowShapeModel;
public preDefinedProcess?: FlowShapeModel;
public segment1?: OrthogonalSegmentModel;
public segment2?: OrthogonalSegmentModel;
public nodeDefaults(node: NodeModel): NodeModel {
node.height = 50;
node.width = 140;
node.offsetX = 300;
if(node.id === "node1" || node.id === "node4"){
node.style = { fill: "#357BD2", strokeColor: "white" };
}else if(node.id === "node2" || node.id === "node5"){
node.style = { fill: "yellow", strokeColor: "white" };
}else if(node.id === "node3"){
node.style = { fill: "#00FF00", strokeColor: "white" };
}else if(node.id === "node6"){
node.style = { fill: "red", strokeColor: "white" };
}
return node;
}
public connectorDefaults(obj: ConnectorModel): ConnectorModel {
obj.type = "Orthogonal";
obj.targetDecorator = { shape: "Arrow", width: 10, height: 10 };
return obj;
}
ngOnInit(): void {
this.terminator = { type: 'Flow', shape: 'Terminator' };
this.process = { type: 'Flow', shape: 'Process' };
this.decision = { type: 'Flow', shape: 'Decision' };
this.preDefinedProcess = { type: 'Flow', shape: 'PreDefinedProcess' };
this.segment1 = [{ length: 30, direction: "Right",type:'Orthogonal' }, { length: 300, direction: "Bottom",type:'Orthogonal' }];
this.segment2 = [{ length: 30, direction: "Left",type:'Orthogonal' }, { length: 200, direction: "Top",type:'Orthogonal' }];
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Set default values for all nodes
and connectors
using the getNodeDefaults
and getConnectorDefaults
properties, respectively. For example, if all nodes have the same width and height, move such properties into getNodeDefaults
.
Automatic Organization Chart
The previous ‘Flow Diagram’ section explained how to create a diagram manually. This section demonstrates how to create and position diagrams automatically using data binding.
Business object (Employee information)
Define Employee Information as JSON data. The following code example shows an employee array where Name
serves as a unique identifier and ReportingPerson
identifies the person to whom an employee reports in the organization:
public data: Object[] = [
{
Name: "Elizabeth",
Role: "Director"
},
{
Name: "Christina",
ReportingPerson: "Elizabeth",
Role: "Manager"
},
{
Name: "Yoshi",
ReportingPerson: "Christina",
Role: "Lead"
},
{
Name: "Philip",
ReportingPerson: "Christina",
Role: "Lead"
},
{
Name: "Yang",
ReportingPerson: "Elizabeth",
Role: "Manager"
},
{
Name: "Roland",
ReportingPerson: "Yang",
Role: "Lead"
},
{
Name: "Yvonne",
ReportingPerson: "Yang",
Role: "Lead"
}
];
Map data source
Configure the above “Employee Information” with the diagram so that nodes and connectors are automatically generated using the mapping properties. The following code example demonstrates how to use dataSourceSettings
to map id
and parentId
with the corresponding property names of employee information:
@Component({
selector: "app-container",
template: `<ejs-diagram id="diagram" width="100%" height="580px" [dataSourceSettings]='dataSourceSettings'></ejs-diagram>`
})
export class AppComponent {
@ViewChild("diagram")
public dataSourceSettings: DataSourceModel;
public data: Object[] = [
{
Name: "Elizabeth",
Role: "Director"
},
{
Name: "Christina",
ReportingPerson: "Elizabeth",
Role: "Manager"
},
{
Name: "Yoshi",
ReportingPerson: "Christina",
Role: "Lead"
},
{
Name: "Philip",
ReportingPerson: "Christina",
Role: "Lead"
},
{
Name: "Yang",
ReportingPerson: "Elizabeth",
Role: "Manager"
},
{
Name: "Roland",
ReportingPerson: "Yang",
Role: "Lead"
},
{
Name: "Yvonne",
ReportingPerson: "Yang",
Role: "Lead"
}
];
ngOnInit(): void {
this.dataSourceSettings = {
id: "Name",
parentId: "ReportingPerson",
dataManager: new DataManager(this.data as JSON[])
};
}
}
Rendering layout with Datasource
To create an organizational chart, set the type
of layout as OrganizationalChart
. The following code example shows how DataManager generates layouts based on the DataSourceSettings of the Diagram:
import { ConnectorModel, DataBinding, DataSourceModel, Diagram, DiagramComponent, DiagramModule,HierarchicalTree,LayoutModel, NodeModel, ShapeStyleModel } from '@syncfusion/ej2-angular-diagrams'
import { Component, ViewEncapsulation, ViewChild } from "@angular/core";
import { DataManager } from "@syncfusion/ej2-data";
export interface EmployeeInfo {
Name: string;
Role: string;
color: string;
}
Diagram.Inject(DataBinding,HierarchicalTree);
@Component({
imports: [
DiagramModule
],
standalone: true,
selector: "app-container",
template: `<ejs-diagram id="diagram" width="100%" height="580px" [layout]='layout' [dataSourceSettings]='dataSourceSettings' [getNodeDefaults]='nodeDefaults' [getConnectorDefaults]='connectorDefaults'>
</ejs-diagram>`
})
export class AppComponent {
@ViewChild("diagram")
public diagram?: DiagramComponent;
public data: Object[] = [
{
Name: "Elizabeth",
Role: "Director",
ReportingPerson:null
},
{
Name: "Christina",
ReportingPerson: "Elizabeth",
Role: "Manager"
},
{
Name: "Yoshi",
ReportingPerson: "Christina",
Role: "Lead"
},
{
Name: "Philip",
ReportingPerson: "Christina",
Role: "Lead"
},
{
Name: "Yang",
ReportingPerson: "Elizabeth",
Role: "Manager"
},
{
Name: "Roland",
ReportingPerson: "Yang",
Role: "Lead"
},
{
Name: "Yvonne",
ReportingPerson: "Yang",
Role: "Lead"
}
];
public dataSourceSettings?: DataSourceModel = {
id: "Name",
parentId: "ReportingPerson",
dataManager: new DataManager(this.data as JSON[]),
doBinding: (nodeModel: NodeModel, data: object) => {
nodeModel.annotations = [
{ content: (data as EmployeeInfo).Name, style: { color: "white" } }
];
}
};
public layout: LayoutModel = {
type:'OrganizationalChart'
};
public nodeDefaults(node: NodeModel): NodeModel {
let codes: Object = {
Director: "rgb(0, 139,139)",
Manager: "rgb(30, 30,113)",
Lead: "rgb(0, 100,0)"
};
node.width = 70;
node.height = 30;
node.annotations = [
{ content: (node.data as EmployeeInfo).Name, style: { color: "white" } }
];
((node as NodeModel).style as ShapeStyleModel).fill = (codes as any)[(node.data as EmployeeInfo).Role] as string;
return node;
}
public connectorDefaults(connector: ConnectorModel): ConnectorModel {
connector.type = "Orthogonal";
connector.cornerRadius = 7;
return connector;
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Customize employee appearance
The following code examples show how to define the default appearance of nodes and connectors. The setNodeTemplate
method updates each node based on employee data:
import { ConnectorModel, DataBinding, DataSourceModel, Diagram, DiagramComponent, DiagramModule, HierarchicalTree, ImageElement, LayoutModel, NodeModel, StackPanel, TextElement } from '@syncfusion/ej2-angular-diagrams'
import { Component, ViewEncapsulation, ViewChild } from "@angular/core";
import { DataManager } from "@syncfusion/ej2-data";
export interface EmployeeInfo {
Name: string;
Role: string;
color: string;
}
Diagram.Inject(HierarchicalTree,DataBinding);
@Component({
imports: [
DiagramModule
],
standalone: true,
selector: "app-container",
template: `<ejs-diagram id="diagram" width="100%" height="580px" [layout]='layout' [dataSourceSettings]='dataSourceSettings'
[getConnectorDefaults]='connectorDefaults' [setNodeTemplate]='setNodeTemplate'>
</ejs-diagram>`,
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
@ViewChild("diagram")
public diagram?: DiagramComponent;
public data: Object[] = [
{
Name: "Elizabeth",
Role: "Director",
ReportingPerson:null
},
{
Name: "Christina",
ReportingPerson: "Elizabeth",
Role: "Manager"
},
{
Name: "Yoshi",
ReportingPerson: "Christina",
Role: "Lead"
},
{
Name: "Philip",
ReportingPerson: "Christina",
Role: "Lead"
},
{
Name: "Yang",
ReportingPerson: "Elizabeth",
Role: "Manager"
},
{
Name: "Roland",
ReportingPerson: "Yang",
Role: "Lead"
},
{
Name: "Yvonne",
ReportingPerson: "Yang",
Role: "Lead"
}
];
public dataSourceSettings?: DataSourceModel = {
id: "Name",
parentId: "ReportingPerson",
dataManager: new DataManager(this.data as JSON[]),
};
public layout: LayoutModel = {
type:'OrganizationalChart'
};
public connectorDefaults(connector: ConnectorModel): ConnectorModel {
connector.type = "Orthogonal";
connector.cornerRadius = 7;
return connector;
}
public setNodeTemplate(node: NodeModel) {
let codes: Object = {
Director: "rgb(0, 139,139)",
Manager: "rgb(30, 30,113)",
Lead: "rgb(0, 100,0)"
};
let content = new StackPanel();
content.id = node.id + "_outerstack";
content.orientation = "Horizontal";
content.style.strokeColor = "gray";
content.style.fill = (codes as any)[(node.data as EmployeeInfo).Role] as string;
content.padding = { left: 5, right: 5, top: 5, bottom: 5}
let innerContent = new ImageElement();
innerContent.style.strokeColor = "blue";
innerContent.id = node.id + "_innerstack";
innerContent.style.fill = "skyblue";
innerContent.width = 50;
innerContent.height = 50;
let text = new TextElement();
text.id = node.id + "_text";
text.content = (node.data as EmployeeInfo).Name;
text.margin = { left: 15, right: 5, top: 5, bottom: 5}
text.style.color = "black";
content.children = [innerContent, text];
return content;
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
NOTE
Projects generated through Angular CLI automatically detect changes made to the application and compile them. You don’t need to run “npm start” for each change made to the application.