diff --git a/templates/graph.html b/templates/graph.html index bf9696a..dac5f65 100644 --- a/templates/graph.html +++ b/templates/graph.html @@ -4,9 +4,11 @@ const graphData = {{ graph_data | tojson }}; const Graph = ForceGraph()(document.getElementById('graph')) - .graphData(graphData) - .nodeLabel(node => node.username) - .onNodeClick(node => console.log(node)); - + .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)); + Graph.onEngineStop(() => Graph.zoomToFit(400)); \ No newline at end of file