0
シナリオのようなフローチャートでVis.jsを使用しようとしています。ノードの場所を手動で修正する
私はデータベースからフローチャートの情報を取得しており、Vis.jsを使用してフローチャートノードを適切にレイアウトするのに役立ちます。
ただし、STARTノードとENDノードを常にコンテナの左端と中央の中央に配置します。
私はそうすることができません。
私のコードは、これまでのところ、このペンである:私は、コンテナに対して固定STARTの位置とエンドノードを取得し、VISは、JSの世話を聞かせてはどうすればよい
var container = document.getElementById('visualization');
var nodes = [];
var edges = [];
nodes.push({
id: 1,
label: "START",
shape: "box",
fixed: {
x: true,
y: true,
},
x: 100,
y: 100,
});
nodes.push({
id: 2,
label: "test node 2"
});
nodes.push({
id: 3,
label: "test node 3"
});
nodes.push({
id: 4,
label: "test node 4\n Second line"
});
nodes.push({
id: 99,
label: "END",
fixed: true,
shape: "box",
});
edges.push({
from: 1,
to: 2,
label: 'text'
});
edges.push({
from: 1,
to: 3
});
edges.push({
from: 3,
to: 99
});
edges.push({
from: 2,
to: 4
});
edges.push({
from: 4,
to: 99
});
edges.push({
from: 3,
to: 4
});
var data = {
nodes: nodes,
edges: edges
};
var options = {
physics: {
enabled: true,
stabilization: true,
barnesHut: {
avoidOverlap: 1
},
},
edges: {
arrows: {
to: {
enabled: true,
scaleFactor: 1
},
middle: {
enabled: false,
scaleFactor: 1
},
from: {
enabled: false,
scaleFactor: 1
}
},
}
};
var timeline = new vis.Network(container, data, options);
http://codepen.io/anon/pen/WwdGvP
残りのレイアウト?
私はすでにそれを行っていますが、私の質問は、ノードがキャンバス上の固定された座標位置に表示されるように座標を指定する方法です。 – Pratik
キャンバスを移動/ズームしていても、左右の端に固定したいと思っていますか? – SonIcco
はい。私はフローチャートを作成しています。それは、ページの真ん中に浮かび上がる開始点と終了点を持つ意味がありません – Pratik