Thanks for the reply, that helped a lot.
I'm getting this error:
My systemjs config file is pretty much like this one:
Error: (SystemJS) ej is not defined
https://github.com/syncfusion/angular2-seeds/blob/systemjs/systemjs.config.js/#L27-L28
Also, I had to copy the folder node_modules/@types/userhandles to my project's folder, I'm gessing this is not available in npm.
Edit:
The solution was to add:
import 'syncfusion-javascript/Scripts/ej/datavisualization/ej.diagram.min';
|
Query |
Response |
|
Thanks for the reply, that helped a lot.
I'm getting this error:
My systemjs config file is pretty much like this one:
Error: (SystemJS) ej is not defined https://github.com/syncfusion/angular2-seeds/blob/systemjs/systemjs.config.js/#L27-L28 |
The reported issue occurs due to ej-angular2 is not referred in the app.module.ts file. Could you please refer it to resolve your reported issue. Please refer to the code example below.
Code example:
App.module.ts
import { EJAngular2Module } from 'ej-angular2';
However we have created a flowchart sample with system JS and provided the sample below.
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/7z/angular2-seeds-systemjs1357728363
|
|
Also, I had to copy the folder node_modules/@types/userhandles to my project's folder, I'm gessing this is not available in npm. |
Yes, you need to copy the userhandles file to your project because toolbase class could not be implemented in the ej.web.all.d.ts. So only we have used that class in a separate file to render the userhandles tools. |
|
Query |
Response |
|
When I add a new node from the palette, I log the nodes variable and I don't see the new node is being added there. Any idea? |
Could you please confirm us whether you are using drop event to get the dropped node and using diagram.model.selectedItems.children[0] to get the selected node? If yes, please use nodeCollectionChange event in which set the arguments state property as changed to achieve your requirement. please refer to the code example, sample and help documentation below. if we misunderstood your requirement, please provide us more details such as elaborate your requirement in detail with screenshot or video.
Code example:
<ej-diagram id="diagramCore" (nodeCollectionChange)="nodeCollectionChange($event)">
</ej-diagram>
nodeCollectionChange(args){
if(args.state==="changed"){
//get the selectedNode
var node=args.element;
console.log(node.name)
}
}
Help documentation: https://help.syncfusion.com/api/js/ejdiagram#events:nodecollectionchange
|
|
I'm binding to itemClick event on the diagram, and from that event I'm trying to get the node that user clicked on as follows:
var diagram : any = $("#diagramCore").ejDiagram("instance");
var node = diagram.model.selectedItems.children[0]; |
In the itemClick event, please use arguments element property to get the selected node. please refer to the code example, sample and help documentation below.
Code example:
<ej-diagram id="diagramCore" (itemClick)="itemClick($event)">
</ej-diagram>
itemClick(args){
//get the selectedNode
var node=args.element;
console.log(node.name)
}
Help documentation: https://help.syncfusion.com/api/js/ejdiagram#events:itemclick
Also for doubleClick event , please use arguments element property to get the selected node.
|
|
When I change a node name by double clicking on the shape and editing the text, that won't change the name property in the selected node.
What I'm trying to do is save the node variable to database after the user finished editing it to repopulate it on page reload. |
We should not change the object’s name(node/connector/port) at runtime because it is a unique id for all the DOM elements. Also based on the object name, we have changed the object appearance or other functionality. Instead of using nodes name, you can use node’s addInfo property(custom property) and can save it to the database and repopulate it on page reload. Please refer to the code example to define node’s addInfo property.
Code example:
this.nodes = [
{
name: "node1", width: 200, height: 230, offsetX: 200, offsetY: 200,addInfo:"node11"
},
];
Help documentation: https://help.syncfusion.com/api/js/ejdiagram#members:nodes-addinfo
|
Thanks Shyam for asking. Actually the next thing I'm trying is to show text or an icon in the upper right of a node (from withing the node, not outside like the user handle). This text is dynamic and would change. It's basically a counter for the number of times the user clicked on the userhandle Settings (the icon from the upper left).
See the sample image:
https://i.imgur.com/5tuKQCg.png
so, when hovering over the node, it will show 3 on the upper right. If I click on the userhandle on the left, the number will change to 4. If I hover over this number 4, it will show me some tooltip message.
In short, I want to add something like this in the upper right:
{{counter}}
Any update on this?
|
Query |
Response |
|
Also, are you planning on adding two-way data binding support for your Angular component?
<ej-diagram id="diagramCore" [nodes]="nodes" [connectors]="connectors"> </ej-diagram>
So we can use [(nodes)]="nodes" ? |
Yes, we can do two way binding in our diagram control. we have created a sample in which we have done two way binding for nodes. Please refer to the code example and sample below.
Code example:
<button (click)="addNodes()">addNodes</button>
<!--node binding-->
<ej-diagram width="1000px" [(nodes)]="nodes" >
</ej-diagram>
addNodes(){
var test=this.nodes.slice();
test.push({name:"node3"+this.nodes.length,width:100,height:100,offsetX:400 +this.nodes.length,offsetY:400+this.nodes.length});
this.nodes=test;
}
Please refer to the video below in which we have demonstrated how two way binding works for node.
|
|
I've one more issue. I want to use the tooltip on nodes and I followed this tutorial:
https://help.syncfusion.com/js/diagram/tooltip
However, the tooltip shown is text: #nodetooltiptemplate |
The reported issue occurs only if you refer the script template other than index.html file. You should refer script template only in index.html file. please refer to the link below.
We have created a sample in which we have rendered tooltip for nodes.
|
Hi Hussain,Please use drag event to achieve your requirement. in this event, you can do your action when the arguments dragState is completed. Please refer to the code example below.Code example:<ej-diagram id="diagramCore" (drag)= "drag($event)" ></ej-diagram>drag(args) {if (args.dragState === "completed") {//do your action}}Regards,Shyam G