What is the problem? The value of the “points” property appears to be an Array of Points, although it should be a List of Points. It is the responsibility of the serialization to convert that List of Points (or Array of Points) into whatever representation you are serializing into so that deserialization can properly recover a List or Array of the correct coordinate values.
That is done automatically for you in the Model.toJson method and Model.fromJson static function. But you can implement your own serialization if you like.
Problem is that this array is not visualising into diagram. So I probably have to use some method to make them a List of Points, not an Array of Points as you just typed. But I didn’t find the method, could you please tell me if there is some? @walter
Just to be clear – are you doing your own persistence of the model? You are not using Model.toJson or Model.fromJson, are you?
If you are doing your own persistence implementation, then you should be able to handle the “points” property value being whatever types you want to handle.
By the way, as you can read at Link | GoJS API, the Link.points property setter will accept more than just a List of Points – it also handles Arrays of Points and even-length Arrays of numbers.
The form of your link data “points” property. The value of the Link.points property is a List of Points. So a simple TwoWay Binding of the “points” property will result in the link data.points property being a List, not an Array. If you really want it to be an Array, you need to provide a back-conversion function. Although I think it would be inefficient to do this – it would be more efficient to only do the conversion to Array when you serialize the data.
When you move a node all of the connected links will be rerouted – otherwise the link paths will appear disconnected. But you have some control over how rerouting works. Try setting Link.adjusting to some value.
Thanks a lot @walter. After a few days I just get back to this project and my solution is to take my Array and make List of Points, then bind it to the ‘points’ property as shown below:
new go.Binding('points', 'points', (data) => {
let list = new go.List();
list.add(new go.Point(data[1].x, data[1].y));
list.add(new go.Point(data[0].x, data[0].y));
list.add(new go.Point(data[2].x, data[2].y));
list.add(new go.Point(data[3].x, data[3].y));
console.log(list);
return list;
}),