Skip to content

Commit

Permalink
add some padding when there's a low node count in the graph
Browse files Browse the repository at this point in the history
  • Loading branch information
skylenet committed Sep 9, 2024
1 parent 1435128 commit b2cba61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions static/js/cytoscape-network-aux.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ $_network.layouts = {
animate: false,
stop: function() {
$("#nodemap-loading").hide();
}
},
padding: nodeCount < 20 ? 200 : 0,
}
},
circle : function() {
Expand All @@ -50,10 +51,11 @@ $_network.layouts = {
animate: false,
}
},
concentric : function() {
concentric : function(nodeCount) {
return {
name: 'concentric',
animate: false,
padding: nodeCount < 20 ? 200 : 0,
concentric: function( node ){
return node.data('group') == 'internal' ? 2 : 1;
},
Expand Down
2 changes: 1 addition & 1 deletion templates/clients/clients_cl.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2 class="accordion-header">
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="CoSE" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.fcose(data.nodes.length))'><i class="fa-solid fa-share-alt"></i></button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Circle" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.circle())'><i class="fa-solid fa-circle"></i></button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Grid" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.grid())'><i class="fa-solid fa-th"></i></button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Concentric" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.concentric())'><i class="fa-solid fa-sun"></i></button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Concentric" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.concentric(data.nodes.length))'><i class="fa-solid fa-sun"></i></button>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/clients/clients_el.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2 class="accordion-header">
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Cose" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.fcose(data.nodes.length))'><i class="fa-solid fa-share-alt"></i></button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Circle" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.circle())'><i class="fa-solid fa-circle"></i></button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Grid" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.grid())'><i class="fa-solid fa-th"></i></button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Concentric" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.concentric())'><i class="fa-solid fa-sun"></i></button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Concentric" class="btn btn-secondary" onclick='$_network.fitAnimated(cy,$_network.layouts.concentric(data.nodes.length))'><i class="fa-solid fa-sun"></i></button>
</div>
</div>
</div>
Expand Down

0 comments on commit b2cba61

Please sign in to comment.