LinkDataArray and To/From spot

Hi, I’am having problems in saving and reloading correctly my links.
I am using the LinkShiftingTools to adjust the from and to spot

In diagram events listener I have in place the logic to save the link information like points, toSpot, and fromSpot like the following:


and in the model I have the corresponding bindings:
new go.Binding (“fromSpot”,“fromSpot”,go.Spot.parse).makeTwoWay(go.Spot.stringify),
new go.Binding (“toSpot”,“toSpot”,go.Spot.parse).makeTwoWay(go.Spot.stringify),

but when I set the link data array like the following:
link data array= [{“from”:“6401”,“to”:“6501”,“text”:"",“category”:"",routing":“go.Link.Orthogonal”,“isTreeLink”:false,“points”:[0.0,71.0,90.5,81.0,90.5,107.75,220.0,107.75,220.0,20.0,300.0,20.0,300.0,120.0,360.0,120.0,360.0,134.5,360.0,0.0],“adjusting”:“go.Link.Stretch”,“fromSpot”:“0.5 1 0 0”,“toSpot”:“0.5 0 0 0”}]

the link’s route is not preserved, in particular the start and the end of the link are wrong

What else information I am missing to save/restore?


If you are using TwoWay Bindings the property values will automatically be saved in the model. There would be no need to save those property values into the model in a DiagramEvent listener.

So what are you doing in which listeners?

Hi Walter, I found the problem. My routine for saving link’s points was accidentally corrupting the first and last char of the sequence, making the first X and the last Y get interpreted as zero. Now everything is working as expected