Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Reload Diagram Link is not the same

$
0
0

@tri wrote:

Hi

I got a problem when reload the diagram. It allows user to change node position. And when user click save, I currently save the node position (x,y).

Then when user enter again, it will load the node positions and init the diagram. But the problem is the the Link does not look the same.

Below is how I init the node with its positions:

let offlinePosition = vm.position.nodePosition;

  for (let i = 0; i < vm.uniqueNodes.length; i++) {
    let item = vm.uniqueNodes[i];
    // let topArray = [];
    let obj = {
      "key": i,
      "text": item,
    };

    _.map(linkDataArray, function (n) {
      if (n.from == i) {
        // topArray.push({"portColor": "#14abef", "portId": n.fromPort});
        obj.node = n.fromNode;
        obj.opacityNumber = n.opacity;
      }
      if (n.to == i) {
        // topArray.push({"portColor": "#14abef", "portId": n.toPort});
        obj.node = n.toNode;
        obj.opacityNumber = n.opacity;
      }
    });

    if (offlinePosition && offlinePosition[obj.node.SysId]) {
      obj["pos"] = offlinePosition[obj.node.SysId];
    }

    obj.category = addCategory(obj);

    // obj.topArray = topArray;

    nodeDataArray.push(obj);
  }

  vm.chartData = {
    "nodeDataArray": nodeDataArray,
    "linkDataArray": linkDataArray
  }

Thank you in advance !!!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles