force-graph icon indicating copy to clipboard operation
force-graph copied to clipboard

How to control the length between nodes and clusters of nodes

Open moda20 opened this issue 2 years ago • 3 comments

Hi, i am creating a graph with a central node and 4 clusters each with as mcuh as 1k nodes, the issue i am having is the distance between the central node and the clusters. this doesn't seem to be configurable in any way from the available interface. by default the length it seems to be related to the number of nodes in each cluster, but can't be configured to be otherway

in the attached pic, the length i am speaking with is the dashed line

Screenshot 2023-01-23 at 16 06 11

moda20 avatar Jan 23 '23 15:01 moda20

You can control the intended distances per link using the forceLink distance method.

This method can be accessed via:

myGraph.d3Force('link').distance(link => ...)

vasturiano avatar Jan 25 '23 12:01 vasturiano

@vasturiano thanks, but the a small problem there is that i also need to change the charge force to achieve what i want to do but that has a weird bug, and i created an issue about it

moda20 avatar Jan 25 '23 12:01 moda20

Hello @moda20,

can i have the code you used for clustering?

Thank you.

Yass525 avatar Sep 14 '23 13:09 Yass525