I am trying to get a cocentric circular layout working, which I based on the double circle example. The placement of each ring is meant to communicate distance from a center node in the raw graph data, so it’s important that the radius effectively makes each successive ring appear outside the inner rings, despite the number of nodes in each ring.
I am facing a problem in that radius is being shrunk whenever I have spacing enabled and when an outer ring has fewer nodes than an inner ring. I would like to use spacing because otherwise I would have to adjust radius myself to make sure nodes don’t overlap.
I have attached two pictures of my modified doubleCircle.html example. The one without spacing shows the rings in the proper order but the nodes overlap. In the one with spacing set to 0, the blue ring appears inside the green ring when it should appear outside.
I know from the documentation that actual radius may be larger in order to satisfy that actual spacing is greater than or equal to configured spacing - however, the behavior I am seeing is the opposite where the actual radius is smaller, which I did not see mentioned.
Any ideas on how I can both use spacing and enforce the radius at each ring?
The documentation says that radius is ignored when the Packed arrangement is used. It looks like when I use that arrangement, my problem is still there - the size of each ring is depending on the number of nodes, rather than the radius I am setting. I attached the screenshot when using Packed, and the blue-green ring which should be the outermost ring is still inside of the green ring:
Here is the data I am setting up in the double circle sample for better clarity on what I am going for. The higher the layer property, the farther out the ring should be from the center. It works fine when each successive layer has more nodes than the last, but when an outer layer has fewer nodes it has this problem.
Oh, so you want to have nodes overlapping in the same circle/ellipse? That’s unusual, but you can set spacing to negative numbers.
Why don’t you layout the innermost circle, find out how big it is, and then layout out the next one to fit around it, etc.? Look at the actual… properties after the layout.
Oh, so you want to have nodes overlapping in the same circle/ellipse?
No, I do not want the nodes overlapping in the same ellipse.
My two requirements are:
Each circle has a bigger actual radius depending on the “layer” property in the data.
The nodes do not overlap. (However, it’s OK if there is a lot of space between the nodes which may be the case when the outer most layer has few nodes compared to inner layers).
Does this make sense so far? Sorry if I am not being clear.
I can achieve #1 if I set spacing to NaN, and #2 if I set spacing to a number, but I’m having trouble getting both at the same time (see my initial post for the screenshots with spacing / without).
Good idea about using actualRadius to set the radius for next layer. I tried something like this, but I am still seeing my the outer layer (with 40 nodes) appear inside the inner layer (with 50 nodes).
i have issue when apply your code in my demo:
Overlapping happen between root node(layer:0) with nodes(layer 1).
do you guys have any comment for this situation.
See demo demo circular layout
I answered your colleague’s question via email, please refer to that conversation, and try to limit yourselves to one method of communication so everything is organized.