Skip to content

Commit

Permalink
#1 d3 force
Browse files Browse the repository at this point in the history
  • Loading branch information
Scobiform committed Apr 17, 2024
1 parent bc28b94 commit 552de5a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions templates/graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
const Graph = ForceGraph()(document.getElementById('graph'))
.graphData(graphData)
.nodeLabel(node => node.username)
.force('charge', d3.forceManyBody().strength(-120)) // Adjust strength for repulsion or attraction
.force('link', d3.forceLink().id(d => d.id).distance(50)) // Adjust link distance
.onNodeClick(node => console.log(node));

// Configuration for forces if supported by the library
Graph.d3Force('charge', d3.forceManyBody().strength(-120));
Graph.d3Force('link', d3.forceLink().distance(50));

Graph.onEngineStop(() => Graph.zoomToFit(400));

</script>

0 comments on commit 552de5a

Please sign in to comment.