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.

62 lines
1.4 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JS Bin</title>
  6. <script type="text/javascript" src="../dist/vis.js"></script> <!-- network handling framework -->
  7. <link href="../dist/vis.css" rel="stylesheet" type="text/css"/>
  8. <style type="text/css">
  9. #network{
  10. width: 1200px;
  11. height: 800px;
  12. border: 1px solid lightgray;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <h1>Network Test</h1>
  18. <div id="network"></div>
  19. <script type="text/javascript">
  20. // create a network
  21. var container = document.getElementById('network');
  22. var nodes = new vis.DataSet([]);
  23. var edges = new vis.DataSet([]);
  24. // create a network
  25. var data = {
  26. nodes: nodes,
  27. edges: edges
  28. };
  29. // data.nodes.update({id: 0, label: 'node 1'});
  30. var fontFace = 'roboto,"helvetica neue","segoe ui",arial,helvetica,sans-serif';
  31. var options = {
  32. autoResize: true,
  33. interaction: {
  34. hover: true
  35. },
  36. width: '100%',
  37. height: '400px',
  38. nodes: {
  39. shape: 'dot',
  40. font: {
  41. size: 13,
  42. face: fontFace,
  43. strokeColor: '#fff',
  44. strokeWidth: 5
  45. }
  46. }
  47. };
  48. var network = new vis.Network(container, data, options);
  49. function info(s) {
  50. document.getElementById('num').innerText += s + '\n';
  51. }
  52. </script>
  53. </body>
  54. </html>