Pregunta

So, I have a force layout graph, with something like 30 circles in it. Some circles are connected to a central circle, some are not.

What I wanna do is have smaller objects floating around the main circles (maybe with a higher gravity or a smaller distance).

How do you reckon I should proceed? Thank you,

¿Fue útil?

Solución

All right, Lars helped me find a solution.

I started by customizing the .charge() to something more appropriate. The function is below, provided there's this type="f" in your code:

.charge(function(d) {
if (d.type === "f") { return -50;
} else { return -700;
}
})

Then, and just for design purposes, I changed the .linkDistance following the same method.

.linkDistance(function(d) {
if (d.type === "f") { return 5;
} else { return 30;
}
})

Here's the result: Result

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top