Skip to content

Commit

Permalink
Adjust d3 forces #15
Browse files Browse the repository at this point in the history
  • Loading branch information
Scobiform committed Apr 20, 2024
1 parent 1bb09f1 commit a0b014c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions templates/graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@
.id(d => d.id)
.distance(link => {
// Optionally adjust link distances based on node attributes if required
if (link.type === 'instance') return 200 + 5 * Math.sqrt(link.source.connectionCount);
else if (link.type === 'followers') return 150 + 2 * Math.sqrt(link.source.followerCount);
else if (link.type === 'followings') return 100 + 2 * Math.sqrt(link.source.followerCount);
else return 50; // Default distance for other or undefined types
if (link.type === 'instance') return 4200 + 5 * Math.sqrt(link.source.connectionCount);
else if (link.type === 'followers') return 2100 + 2 * Math.sqrt(link.source.followerCount);
else if (link.type === 'followings') return 1400 + 2 * Math.sqrt(link.source.followerCount);
else return 10000; // Default distance for other or undefined types
})
.strength(0.5));

Expand Down

0 comments on commit a0b014c

Please sign in to comment.