diff --git a/html/includes/print-map.inc.php b/html/includes/print-map.inc.php index 0deb618065..b79e9f54aa 100644 --- a/html/includes/print-map.inc.php +++ b/html/includes/print-map.inc.php @@ -71,6 +71,7 @@ $ports = dbFetchRows("SELECT `P2`.`port_id` IS NOT NULL AND `D1`.`device_id` != `D2`.`device_id` $sql + GROUP BY `P1`.`port_id`,`P2`.`port_id` ", $sql_array); $devices = dbFetchRows("SELECT @@ -109,6 +110,7 @@ $devices = dbFetchRows("SELECT `local_device_id` IS NOT NULL AND `remote_device_id` IS NOT NULL $sql + GROUP BY `P1`.`port_id`,`P2`.`port_id` ", $sql_array); $list = array_merge($ports,$devices); @@ -162,7 +164,7 @@ foreach ($list as $items) { $link_color = $config['map_legend'][$link_used]; $tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "",'',0,1),'width'=>$width,'color'=>$link_color); if (!in_array($items['remote_port_id'],$tmp_link_ids)) { - $tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "",'',0,1),'width'=>$width,'color'=>$link_color); + $tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "\n",'',0,1),'width'=>$width,'color'=>$link_color); } array_push($tmp_link_ids,$items['local_port_id']); } @@ -201,27 +203,39 @@ echo $edges; edges: edges, stabilize: true }; - var options = { - autoResize: true, - height: '100%', - width: '100%', - physics: { - barnesHut: { - gravitationalConstant: -10000, springConstant: 0.001, springLength: 50 - } - }, - tooltip: { - color: { - background: '#ffffff' - } - }, - smoothCurves: {dynamic:false, type: "continuous"}, - edges: { - color: { - color: '#000000' - } - } - }; +var options = { + layout:{ + randomSeed:2 + }, + "edges": { + "smooth": { + "type": "continuous", + "roundness": 0.95 + }, + font: { + size: 12, + color: 'red', + face: 'sans', + background: 'white', + strokeWidth:3, + align: 'bottom' + } + }, + "physics": { + "forceAtlas2Based": { + "gravitationalConstant": -800, + "centralGravity": 0.03, + "springLength": 50, + "springConstant": 0, + "damping": 1, + "avoidOverlap": 1 + }, + "maxVelocity": 50, + "minVelocity": 0.01, + "solver": "forceAtlas2Based", + "timestep": 0.30 + } +} var network = new vis.Network(container, data, options); network.on('click', function (properties) { if (properties.nodes > 0) {