All versions of this documentation
X

Font


Open in a new window.
          <!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
  <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'
});

ogma.styles.addNodeRule({
  text: {
    font: 'Roboto',
    minVisibleSize: 5,
    content: function (n) { return 'Node ' + n.getId(); }
  }
});

ogma.styles.addEdgeRule({
  text: {
    font: 'Times New Roman',
    minVisibleSize: 3,
    content: function (e) { return 'Edge ' + e.getId(); }
  }
});

ogma.generate.random({ nodes: 15, edges:15 }).then(function(g) {
  ogma.setGraph(g);
  ogma.view.locateGraph();
});

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