You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to change the constant layout option to a circular layout which doesn't care about the number of crosses and just arranges the nodes in the form of a circle. The algo I'm using is:
var r = Math.min(this.width, this.height) / 2;
/* Where to start the circle. */
var dx = this.width / 2;
var dy = this.height / 2;
/* Calculate the step so that the vertices are equally apart. _/
var step = 2_Math.PI / graph.vertexCount;
var t = 0; // Start at "angle" 0.
for (var i = 0; i<graph.vertices.length; i++) {
var v = graph.vertices[i];
v.x = Math.round(r_Math.cos(t) + dx);
v.y = Math.round(r_Math.sin(t) + dy);
t = t + step;
}
I'm not able to figure out how to incorporate the algo into Viva so as to make it a circular layout. Any help is appreciated. :)
The text was updated successfully, but these errors were encountered:
I'm trying to change the constant layout option to a circular layout which doesn't care about the number of crosses and just arranges the nodes in the form of a circle. The algo I'm using is:
var r = Math.min(this.width, this.height) / 2;
/* Where to start the circle. */
var dx = this.width / 2;
var dy = this.height / 2;
/* Calculate the step so that the vertices are equally apart. _/
var step = 2_Math.PI / graph.vertexCount;
var t = 0; // Start at "angle" 0.
for (var i = 0; i<graph.vertices.length; i++) {
var v = graph.vertices[i];
v.x = Math.round(r_Math.cos(t) + dx);
v.y = Math.round(r_Math.sin(t) + dy);
t = t + step;
}
I'm not able to figure out how to incorporate the algo into Viva so as to make it a circular layout. Any help is appreciated. :)
The text was updated successfully, but these errors were encountered: