|
public created(args: Object): void {
let node: NodeModel = {
// Position of the node
offsetX: 250,
offsetY: 250,
// Size of the node
width: 100,
height: 100,
style: {
fill: '#6BA5D7',
strokeColor: 'white'
},
};
//Add Node
this.diagram.add(this.node);
} |
|
public nodes: NodeModel[] = [
{
id: 'node1', offsetX: 100, offsetY: 100, annotations: [{ content: 'Node1'}], height: 100, width: 100
},
];
<ejs-diagram #diagram id="diagram" width="100%" height="645px" [snapSettings]='snapSettings' [nodes]='nodes' >
</ejs-diagram> |
|
//html
<ejs-diagram #diagram id="diagram" width="100%" height="645px" [snapSettings]='snapSettings' [nodes]='nodes' >
</ejs-diagram>
//ts
//use the same object used in ejs-diagram. So that only diagram instance set, else it set as null.
@ViewChild('diagram')
public diagram: DiagramComponent; |