0

In using mxCircleLayout, one can specify a radius. It seems, however, that the radius only affects a graph where the radius is GREATER than the default based on the graph bounds. In looking at the source code (JGraphX 3.3.1.1) for mxCircleLayout, line 230 has:

        double r = Math.max(vertexCount * max / Math.PI, radius);

where "r" is used as the radius for the circle layout. Shouldn't this be

        double r = Math.min(vertexCount * max / Math.PI, radius);

if I want to have a smaller radius? Perhaps I'm misunderstanding what "radius" means, but for a circle it ought to have the natural meaning. And changing the line gives me the (smaller) circle I want.

1 Answers1

0

The max is used in order to make sure that the vertices do not overlap. See the comment at the start of the execute statement:

    // Moves the vertices to build a circle. Makes sure the
    // radius is large enough for the vertices to not
    // overlap

However, this does seem to use the bounds of the largest vertex, which is not very useful if the vertices have different sizes where the maximum is much larger than the average.

Nieke Aerts
  • 209
  • 2
  • 11