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.

44 lines
898 B

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Network | BasicExample</title>
  5. <script src="/dist/vis.js"></script>
  6. <link href="/dist/vis-network.min.css" rel="stylesheet" type="text/css" />
  7. <style type="text/css">
  8. #network {
  9. width: 600px;
  10. height: 400px;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <div id="network"></div>
  16. <script type="text/javascript">
  17. var nodes = new vis.DataSet([
  18. {id: 1, label: 'Node 1'},
  19. {id: 2, label: 'Node 2'},
  20. {id: 3, label: 'Node 3'},
  21. {id: 4, label: 'Node 4'},
  22. {id: 5, label: 'Node 5'}
  23. ]);
  24. var edges = new vis.DataSet([
  25. {from: 1, to: 3},
  26. {from: 1, to: 2},
  27. {from: 2, to: 4},
  28. {from: 2, to: 5},
  29. {from: 3, to: 3}
  30. ]);
  31. var container = document.getElementById('network');
  32. var data = {
  33. nodes: nodes,
  34. edges: edges
  35. };
  36. var options = {
  37. layout: {
  38. randomSeed: 1
  39. }
  40. };
  41. var network = new vis.Network(container, data, options);
  42. </script>
  43. </body>
  44. </html>