diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2017-09-21 12:49:18 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2017-09-21 12:49:18 -0400 |
| commit | b28028ac4082842143b0f528d6bc539da6ccb419 (patch) | |
| tree | 1e26ea969a781ed8e323fca4e3c76345113fc694 /www/lib/vis/examples/network/other/clustersOfclusters.html | |
| parent | 676270d21beed31d767a06c89522198c77d5d865 (diff) | |
mega changes, including updates and X
Diffstat (limited to 'www/lib/vis/examples/network/other/clustersOfclusters.html')
| -rw-r--r-- | www/lib/vis/examples/network/other/clustersOfclusters.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/www/lib/vis/examples/network/other/clustersOfclusters.html b/www/lib/vis/examples/network/other/clustersOfclusters.html new file mode 100644 index 00000000..0e90bcf0 --- /dev/null +++ b/www/lib/vis/examples/network/other/clustersOfclusters.html @@ -0,0 +1,75 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Cluster Test</title> + <script type="text/javascript" src="../../../dist/vis.js"></script> + <link href="../../../dist/vis.css" rel="stylesheet" type="text/css"/> + <style type="text/css"> + #network_graph { + width: 1000px; + height: 800px; + border: 1px solid lightgray; + } + </style> +</head> +<body onload="draw()"> +<p> + Clusters can contain other clusters, but clusters of a single node is only possible by adding +<pre>allowSingleNodeCluster: true</pre> +to clusterNodeProperties<br/> +In this example repeatedly clicking on the node with open the Clusters. +</p> +<div id="network_graph"></div> +<div id="info"></div> +<script type="text/javascript"> + var network; + + var node_color = ['orange', 'green', 'red', 'yellow', 'cyan']; + var node_shape = ['star', 'database', 'diamond', 'square', 'triangle']; + var nodes = new vis.DataSet([ + {id: 'x', label: 'Node X'}, + {id: 'y', label: 'Node Y'}, + ]); + var network_options = {}; + var edges = new vis.DataSet([ + {from: 'x', to: 'y'} + ]); + + var cluster_id = 1; + + function draw() { + network = new vis.Network( + document.getElementById('network_graph'), + { + nodes: nodes, + edges: edges + }, + network_options + ); + network.on('click', function (params) { + if (params.nodes.length == 1) { + if (network.isCluster(params.nodes[0]) == true) { + network.openCluster(params.nodes[0]); + } + } + }); + cluster(); + cluster(); + cluster(); + } + + function cluster() { + var clusterOptions = { + joinCondition: function (childOptions) { + console.log(childOptions); + return true; + }, + clusterNodeProperties: {id: cluster_id, label: "Cluster " + cluster_id, color: node_color[cluster_id - 1], shape: node_shape[cluster_id - 1], allowSingleNodeCluster: true} + }; + cluster_id++; + network.cluster(clusterOptions); + } +</script> +</body> +</html> |
