Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Load link data (Read 2636 times)
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Load link data
Sep 6th, 2019 at 10:23am
Print Post  
Hi,
I followed this example

https://www.mindfusion.eu/onlinehelp/jsdiagram/CC_Tutorial_1__Loading_Graph_Data...

and working good at my end. Now I also want to show link text which is given while creating link between two nodes. Please tell me how its XML will be created. It is not given in this example.
  
Back to top
AIM  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Load link data
Reply #1 - Sep 7th, 2019 at 6:49am
Print Post  
Hi,

You could add "text" attribute to link objects in the JSON -

Code
Select All
{"origin":0,"target":1,"text": "my link"},
 



and the call setText or addLabel when creating the DiagramLink -

Code
Select All
var diagramLink = diagram.getFactory().createDiagramLink(
    nodeMap[link.origin],
    nodeMap[link.target]);
diagramLink.setText(link.text);
 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: Load link data
Reply #2 - Sep 13th, 2019 at 4:19am
Print Post  
I did in the same manner, but I am not able to see this text in the diagram. Kindly help
linkdata = [{"origin":"9b8192b4-5e84-4086-b123-31e1bdc2e67b18","target":"a768d70c-62f2-406a-b789-9d22b588714e7","text":"TestIcon"}] //it is in json format

var links = linkdata;
if (links !== null) {
ArrayList.forEach(links, function (link) {
link = diagram.getFactory().createDiagramLink(nodeMap[link.origin],
nodeMap[link.target]);

link.setText(link.text);

});
}

with this it hsould get connected among the node "test" and "Getting their desk and other...", but it not linked as you can see in the picture.. please please help.
  

Untitled_008.png ( 39 KB | 305 Downloads )
Untitled_008.png
Back to top
AIM  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Load link data
Reply #3 - Sep 13th, 2019 at 5:37am
Print Post  
The 'link' variable no longer refers to your json object after this line -

link = diagram.getFactory()...

which is the reason I used the 'diagramLink' variable in my reply above.
  
Back to top
 
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: Load link data
Reply #4 - Sep 13th, 2019 at 5:38am
Print Post  
Hi,
I tried with this also, but no effect

ArrayList.forEach(links, function (links) {
                    var diagramLink = diagram.getFactory().createDiagramLink(nodeMap[links.origin], nodeMap[links.target]);

                    diagramLink.setText(links.text);
  
Back to top
AIM  
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: Load link data
Reply #5 - Sep 13th, 2019 at 6:21am
Print Post  
it is resolved now. Thanks
  
Back to top
AIM  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint