diff --git a/static/js/pages/visual-route.js b/static/js/pages/visual-route.js index ff4c151..e36d386 100644 --- a/static/js/pages/visual-route.js +++ b/static/js/pages/visual-route.js @@ -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',