All versions of this documentation
X

Remove edge

We remove an edge from the graph after 1 second.

Open in a new window.
          <!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <script src="../build/ogma.min.js"></script>
  <style>
    #graph-container { top: 0; bottom: 0; left: 0; right: 0; position: absolute; margin: 0; overflow: hidden; }
  </style>
</head>
<body>
  <div id="graph-container"></div>

<script>
'use strict';

var ogma = new Ogma({
  container: 'graph-container',
  graph: {
    nodes: [
      { id: 'n0', attributes: {x: 0, y :0}},
      { id: 'n1', attributes: {x: 50, y :50}}
    ],
    edges: [
      { id:'e0', source:'n0', target:'n1' }
    ]
  }
});

// Remove the edge after 1s
setTimeout(function() {
  ogma.removeEdge('e0');
}, 1000);

// Notice that removeEdges(array) is a faster operation to remove multiple edges at once.

</script>
</body>
</html>