Update static/js/pages/visual-route.js
This commit is contained in:
parent
f8a7dc0572
commit
cf5c76e792
1 changed files with 14 additions and 1 deletions
|
|
@ -63,13 +63,26 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
function drawGraph(data) {
|
function drawGraph(data) {
|
||||||
|
const pathCount = data.path_count || 1;
|
||||||
|
const container = document.getElementById('bgprtv-mynetwork');
|
||||||
|
|
||||||
|
const baseHeight = 400;
|
||||||
|
const heightPerLane = 120;
|
||||||
|
|
||||||
|
const lanes = Math.ceil((pathCount - 1) / 2);
|
||||||
|
|
||||||
|
const newHeight = baseHeight + (lanes * heightPerLane);
|
||||||
|
|
||||||
|
container.style.height = `${Math.max(400, newHeight)}px`;
|
||||||
|
|
||||||
allNodes = new vis.DataSet(data.nodes);
|
allNodes = new vis.DataSet(data.nodes);
|
||||||
allEdges = new vis.DataSet(data.edges);
|
allEdges = new vis.DataSet(data.edges);
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
layout: { hierarchical: false },
|
layout: { hierarchical: false },
|
||||||
edges: {
|
edges: {
|
||||||
arrows: { to: { enabled: true, scaleFactor: 0.7 } }
|
arrows: { to: { enabled: true, scaleFactor: 0.7 } },
|
||||||
|
smooth: { enabled: true, type: "cubicBezier", forceDirection: "horizontal", roundness: 0.85 }
|
||||||
},
|
},
|
||||||
nodes: {
|
nodes: {
|
||||||
shape: 'box',
|
shape: 'box',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue