|
@ -1021,13 +1021,13 @@ var locales = { |
|
|
<p>The options object supplied to the cluster functions can contain these properties:</p> |
|
|
<p>The options object supplied to the cluster functions can contain these properties:</p> |
|
|
<table class="methods"> |
|
|
<table class="methods"> |
|
|
<tr> |
|
|
<tr> |
|
|
<th class="name">Name</th> |
|
|
|
|
|
|
|
|
<th>Name</th> |
|
|
<th>Type</th> |
|
|
<th>Type</th> |
|
|
<th>Description</th> |
|
|
<th>Description</th> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td>joinCondition(<br> <code>nodeOptions: Object</code><br>)</td> |
|
|
<td>joinCondition(<br> <code>nodeOptions: Object</code><br>)</td> |
|
|
<td class="midMethods">Function</td> |
|
|
|
|
|
|
|
|
<td>Function</td> |
|
|
<td><i>Optional for all but the cluster method. </i> The cluster module loops over all nodes that are |
|
|
<td><i>Optional for all but the cluster method. </i> The cluster module loops over all nodes that are |
|
|
selected to be in the cluster and calls this function with their data as argument. |
|
|
selected to be in the cluster and calls this function with their data as argument. |
|
|
If this function returns true, this node will be added to the cluster. You have access to all |
|
|
If this function returns true, this node will be added to the cluster. You have access to all |
|
@ -1056,7 +1056,7 @@ network.clustering.cluster(options); |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td>processProperties(<br> <code>nodeOptions: Object</code><br>)</td> |
|
|
<td>processProperties(<br> <code>nodeOptions: Object</code><br>)</td> |
|
|
<td class="midMethods">Function</td> |
|
|
|
|
|
|
|
|
<td>Function</td> |
|
|
<td><i>Optional. </i> Before creating the new cluster node, this (optional) function will be called with |
|
|
<td><i>Optional. </i> Before creating the new cluster node, this (optional) function will be called with |
|
|
the |
|
|
the |
|
|
properties supplied by you (<code>clusterNodeProperties</code>), all contained nodes and all |
|
|
properties supplied by you (<code>clusterNodeProperties</code>), all contained nodes and all |
|
@ -1069,12 +1069,15 @@ network.clustering.cluster(options); |
|
|
cluster: |
|
|
cluster: |
|
|
<pre class="prettyprint lang-js"> |
|
|
<pre class="prettyprint lang-js"> |
|
|
var options = { |
|
|
var options = { |
|
|
processProperties: function (clusterOptions, childNodes, childEdges) { |
|
|
|
|
|
|
|
|
processProperties: function (clusterOptions, |
|
|
|
|
|
childNodes, childEdges) { |
|
|
var totalMass = 0; |
|
|
var totalMass = 0; |
|
|
var totalValue = 0; |
|
|
var totalValue = 0; |
|
|
for (var i = 0; i < childNodes.length; i++) { |
|
|
for (var i = 0; i < childNodes.length; i++) { |
|
|
totalMass += childNodes[i].mass; |
|
|
|
|
|
totalValue = childNodes[i].value ? totalValue + childNodes[i].value : totalValue; |
|
|
|
|
|
|
|
|
totalMass += childNodes[i].mass; |
|
|
|
|
|
totalValue = childNodes[i].value |
|
|
|
|
|
? totalValue + childNodes[i].value |
|
|
|
|
|
: totalValue; |
|
|
} |
|
|
} |
|
|
clusterOptions.mass = totalMass; |
|
|
clusterOptions.mass = totalMass; |
|
|
if (totalValue > 0) { |
|
|
if (totalValue > 0) { |
|
@ -1088,7 +1091,7 @@ var options = { |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td>clusterNodeProperties</td> |
|
|
<td>clusterNodeProperties</td> |
|
|
<td class="midMethods">Object</td> |
|
|
|
|
|
|
|
|
<td>Object</td> |
|
|
<td><i>Optional. </i> This is an object containing the options for the cluster node. All options |
|
|
<td><i>Optional. </i> This is an object containing the options for the cluster node. All options |
|
|
described |
|
|
described |
|
|
in the <a href="./nodes.html">nodes module</a> are allowed. This allows you to style your cluster |
|
|
in the <a href="./nodes.html">nodes module</a> are allowed. This allows you to style your cluster |
|
@ -1100,7 +1103,7 @@ var options = { |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td>clusterEdgeProperties</td> |
|
|
<td>clusterEdgeProperties</td> |
|
|
<td class="midMethods">Object</td> |
|
|
|
|
|
|
|
|
<td>Object</td> |
|
|
<td><i>Optional. </i> This is an object containing the options for the edges connected to the cluster. |
|
|
<td><i>Optional. </i> This is an object containing the options for the edges connected to the cluster. |
|
|
All |
|
|
All |
|
|
options described in the <a href="./edges.html">edges module</a> are allowed. Using this, you can |
|
|
options described in the <a href="./edges.html">edges module</a> are allowed. Using this, you can |
|
|