All versions of this documentation
X

Edges


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 graph = {
  nodes: [
    { id: 0, attributes: { x: 0,   y: 0,   radius: 20 } },
    { id: 1, attributes: { x: 200, y: 200, radius: 20 } }
  ],
  edges: [
    { id: 0, source: 0, target: 1, attributes: { width: 5 } }
  ]
};

var ogma = new Ogma({
  graph: graph,
  container: 'graph-container'
});

setTimeout(function() {
  ogma.getEdges().setAttributes({
    color: 'red',
    width: 20
  }, 5000);
}, 0);

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