在vis.js网络中,我们在绘图时,节点默认移动到中心,是否有任何选项可以限制

问题描述

我正在尝试将节点设置为 x,y 坐标。 我有两个节点 node1 和 node2。

当前节点 1 的 x,y 坐标为 115,115 节点绘制在屏幕中央。 现在我将节点 1 的 x,y 坐标更改为 5,5

它仍然转到屏幕中央。

// create an array with nodes
var nodes = [{
        id: 1,label: 'node1',x: 115,y: 115
     },{
        id: 2,label: 'node2',x: 50,y: 75
     }];

// create an array with edges
var edges = [
    {from: 1,to: 2},{from: 1,to: 3}
];

// create a network
var container = document.getElementById('mynetwork');
var data = {
    nodes: nodes,edges: edges
};
var options = {
  physics: {
    enabled: false
  }
};
var network = new vis.Network(container,data,options);    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)