From 7c3ed40536ac46c47675a00fe8caf957ff61751a Mon Sep 17 00:00:00 2001
From: josdejong
@@ -1055,10 +1055,11 @@ var nodes = [
getSelection()
- Array of selection elements
- Standard getSelection()
implementation.
- Returns an array with one or multiple selections. Each selection contains
- the property row
. The selections are not ordered.
+ Array of ids
+ Returns an array with the ids of the selected nodes.
+ Returns an empty array if no nodes are selected.
+ The selections are not ordered.
@@ -1083,18 +1084,11 @@ var nodes = [
setSelection(selection)
none
- Standard setSelection(selection)
implementation.
- selection
is an array with selection elements. The visualization
- accepts one or multiple selection elements, which must have the property row
.
- Example usage: graph.setSelection([{"row": 3}]);
.
+ Select nodes.
+
selection
is an array with ids of nodes to be selected.
+ The array selection
can contain zero or multiple ids.
+ Example usage: graph.setSelection([3, 5]);
will select
+ nodes with id 3 and 5.
-function onselect() { - var sel = graph.getSelection(); - - var info = 'selected row(s): '; - for (var i = 0; i < sel.length; i++) { - info += sel[i].row + ' '; - } - - alert(info); +function onSelect() { + alert('selected nodes: ' + graph.getSelection()); } -vis.events.addListener(graph, 'select', onselect); +vis.events.addListener(graph, 'select', onSelect);
@@ -1117,9 +1111,8 @@ vis.events.addListener(graph, 'select', onselect);
setSelection
- is executed. The corresponding rows in the Array are selected.
- getSelection
.
+ is executed. The ids of the selected nodes can be retrieved via the
+ method getSelection
.
+ This example demonstrates dynamically adding, updating and removing nodes + using a DataSet. +
+ +
+ Node+
|
+
+ Edge+
|
+
+ Nodes+ + |
+
+
+ Edges+ + |
+
+
+ Graph+ + |
+
diff --git a/examples/graph/16_dynamic_data.html b/examples/graph/16_dynamic_data.html new file mode 100644 index 00000000..ef25e8a8 --- /dev/null +++ b/examples/graph/16_dynamic_data.html @@ -0,0 +1,265 @@ + + +
+
+ + + + + + + + + +
+