vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
907 B

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Graph | Basic usage</title>
  5. <script type="text/javascript" src="../../vis.js"></script>
  6. </head>
  7. <body>
  8. <div id="mygraph"></div>
  9. <script type="text/javascript">
  10. // create an array with nodes
  11. var nodes = [
  12. {id: 1, text: 'Node 1'},
  13. {id: 2, text: 'Node 2'},
  14. {id: 3, text: 'Node 3'},
  15. {id: 4, text: 'Node 4'},
  16. {id: 5, text: 'Node 5'}
  17. ];
  18. // create an array with edges
  19. var edges = [
  20. {from: 1, to: 2},
  21. {from: 1, to: 3},
  22. {from: 2, to: 4},
  23. {from: 2, to: 5}
  24. ];
  25. // specify options
  26. var options = {
  27. width: '400px',
  28. height: '400px'
  29. };
  30. // create a graph
  31. var graph = new vis.Graph(document.getElementById('mygraph'));
  32. // draw the graph with the created data and options
  33. graph.draw(nodes, edges, options);
  34. </script>
  35. </body>
  36. </html>