From 996298793e06e45c21d9d362fe603a1d8925367c Mon Sep 17 00:00:00 2001
From: Steven
Date: Thu, 1 Sep 2016 08:55:40 +0100
Subject: [PATCH] =?UTF-8?q?Added=20getBaseEdge,=20getClusteredEdges=20upda?=
=?UTF-8?q?teEdge=20and=20updateClusteredNo=E2=80=A6=20(#2055)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Added getBaseEdge, getClusteredEdges updateEdge and updateClusteredNode to allow option changes of the clustered edges as they are no longer the original base Edge
changing edge color is a good example.
i.e network.clustering.updateEdge(originalEdge.id, {color : '#aa0000'});
will now update all edges including the ones that were created when clustering.
Also when clicking on a clustered edge the event returns the clustered Edge id, which doesn't mean a lot.
This can be now converted back into the original edge with
network.clustering.getBaseEdge(clusteredEdge.id)
Similar with updateClusteredNode
This new method allows the options to be changed on a clustered Node.
i.e clicking on a clustered node gives its clustered node id.
Want to change the clustered image to a star then do this
network.clustering.updateClusteredNode(clusteredNodeId, {shape : 'star'});
* Updated docs with getClusteredEdge, getBaseEdge, updateEdge and updateClusteredNode
Also added method subsections into contents
* Added better error handling to updateEdge and updateClusteredNodes
corrected errors spotted by @mojoaxel
* Added example html demonstrating getBaseEdge, getClusteredEdges updateEdge and updateClusteredNode
---
docs/network/index.html | 78 +++++++++++--
.../other/changingClusteredEdgesNodes.html | 107 ++++++++++++++++++
lib/network/modules/Clustering.js | 79 ++++++++++++-
3 files changed, 247 insertions(+), 17 deletions(-)
create mode 100644 examples/network/other/changingClusteredEdgesNodes.html
diff --git a/docs/network/index.html b/docs/network/index.html
index bd7d7c3c..0f8ef8ff 100644
--- a/docs/network/index.html
+++ b/docs/network/index.html
@@ -210,7 +210,20 @@
@@ -420,7 +433,7 @@ var locales = {
the
modules listed above.
-
+
Global methods for the network.
@@ -485,7 +498,7 @@ var locales = {
-
+
Methods related to the canvas.
@@ -532,7 +545,7 @@ var locales = {
Set the size of the canvas. This is automatically done on a window resize.
-
+
Clustering
@@ -607,6 +620,49 @@ var locales = {
network.clustering.findNode('fred') will return ['A','B','C','fred'].
+
+
getClusteredEdges(
+ String baseEdgeId)
+
+
+
Returns: Array
+
Similiar to findNode in that it returns all the edge ids that were created from the provided edge during clustering
+
+
+
+
getBaseEdge(
+ String clusteredEdgeId)
+
+
+
Returns: Value
+
When a clusteredEdgeId is available, this method will return the original baseEdgeId provided in data.edges
+ ie. After clustering the 'SelectEdge' event is fired but provides only the clustered edge. This method can then be used to return the baseEdgeId.
+
Visible edges between clustered nodes are not the same edge as the ones provided in data.edges passed on network creation
+ With each layer of clustering, copies of the edges between clusters are created and the previous edges are hidden, until the cluster is opened.
+ This method takes an edgeId (ie. a base edgeId from data.edges) and applys the options to it and any edges that were created from it while clustering.
Example:
+ network.clustering.updateEdge(originalEdge.id, {color : '#aa0000'});
+ This would turn the base edge and any subsequent edges red, so when opening clusters the edges will all be the same color.
+