mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Community-Nodes are layouted much better, they will request more space if community is larger
This commit is contained in:
parent
6c598253e2
commit
1624adc044
|
@ -64,14 +64,14 @@ function CommunityNode(parent, initial) {
|
|||
|
||||
getDistance = function(def) {
|
||||
if (self._expanded) {
|
||||
return 2 * def;
|
||||
return 2 * def * Math.sqrt(nodeArray.length);
|
||||
}
|
||||
return def;
|
||||
},
|
||||
|
||||
getCharge = function(def) {
|
||||
if (self._expanded) {
|
||||
return 8 * def;
|
||||
return 4 * def * Math.sqrt(nodeArray.length);
|
||||
}
|
||||
return def;
|
||||
},
|
||||
|
|
|
@ -52,17 +52,22 @@ function ForceLayouter(config) {
|
|||
gravity = config.gravity || 0.01, // 0.08
|
||||
charge = config.charge || -1000, // -240
|
||||
*/
|
||||
defaultCharge = config.charge || -600,
|
||||
defaultDistance = config.distance || 160,
|
||||
defaultCharge = config.charge || -600,
|
||||
defaultDistance = config.distance || 80,
|
||||
gravity = config.gravity || 0.08,
|
||||
distance = function(d) {
|
||||
var res = 0;
|
||||
if (d.source._isCommunity) {
|
||||
return d.source.getDistance(defaultDistance);
|
||||
res += d.source.getDistance(defaultDistance);
|
||||
} else {
|
||||
res += defaultDistance;
|
||||
}
|
||||
if (d.target._isCommunity) {
|
||||
return d.target.getDistance(defaultDistance);
|
||||
res += d.target.getDistance(defaultDistance);
|
||||
} else {
|
||||
res += defaultDistance;
|
||||
}
|
||||
return defaultDistance;
|
||||
return res;
|
||||
},
|
||||
charge = function(d) {
|
||||
if (d._isCommunity) {
|
||||
|
|
Loading…
Reference in New Issue