All versions of this documentation
X

Multiline


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';

function randomGraph(N, E) {
  var g = { nodes:[], edges:[] };

  for (var i = 0; i < N; i++) {
    g.nodes.push({
      id: 'n' + i,
      attributes: {
        x: Math.random() * 100,
        y: Math.random() * 100,
        text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus quis libero ex. Maecenas vulputate lectus quis neque finibus, eu scelerisque leo consequat.'
      }
    });
  }

  return g;
}

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

// Disable text hover effect and text overlap detection for the example:
ogma.setOptions({
  detect: { nodeTexts: false },
  texts: { preventOverlap: false }
});

ogma.styles.addNodeRule({
  text: {
    size: 12,
    minVisibleSize: 5,
    maxLineLength: 40
  }
});

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