Update static/js/pages/visual-route.js

This commit is contained in:
Blackwhitebear8 2025-07-06 16:59:56 +02:00
parent f8a7dc0572
commit cf5c76e792

View file

@ -63,13 +63,26 @@ document.addEventListener('DOMContentLoaded', function() {
});
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);
allEdges = new vis.DataSet(data.edges);
const options = {
layout: { hierarchical: false },
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: {
shape: 'box',