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.

72 lines
3.3 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Network | Shapes</title>
  5. <style type="text/css">
  6. #mynetwork {
  7. width: 1000px;
  8. height: 800px;
  9. border: 1px solid lightgray;
  10. }
  11. </style>
  12. <script type="text/javascript" src="../../../dist/vis.js"></script>
  13. <link href="../../../dist/vis.css" rel="stylesheet" type="text/css" />
  14. <script type="text/javascript">
  15. var nodes = null;
  16. var edges = null;
  17. var network = null;
  18. function draw() {
  19. nodes = [
  20. {id: 1, label: 'circle', shape: 'circle' , shapeProperties:{borderDashes:[5,5]}},
  21. {id: 2, label: 'ellipse', shape: 'ellipse', shapeProperties:{borderDashes:[5,5]}},
  22. {id: 3, label: 'database',shape: 'database', shapeProperties:{borderDashes:[5,5]}},
  23. {id: 4, label: 'box', shape: 'box' , shapeProperties:{borderDashes:[5,5]}},
  24. {id: 5, label: 'diamond', shape: 'diamond', shapeProperties:{borderDashes:[5,5]}},
  25. {id: 6, label: 'dot', shape: 'dot', shapeProperties:{borderDashes:[5,5]}},
  26. {id: 7, label: 'square', shape: 'square', shapeProperties:{borderDashes:[5,5]}},
  27. {id: 8, label: 'triangle',shape: 'triangle', shapeProperties:{borderDashes:[5,5]}},
  28. {id: 9, label: 'triangleDown', shape: 'triangleDown', shapeProperties:{borderDashes:[5,5]}},
  29. {id: 10, label: 'text', shape: 'text'},
  30. {id: 11, label: 'star', shape: 'star', shapeProperties:{borderDashes:[5,5]}},
  31. {id: 21, font:{size:30}, label: 'big circle', shape: 'circle' , shapeProperties:{borderDashes:[5,5]}},
  32. {id: 22, font:{size:30}, label: 'big ellipse', shape: 'ellipse', shapeProperties:{borderDashes:[5,5]}},
  33. {id: 23, font:{size:30}, label: 'big database',shape: 'database', shapeProperties:{borderDashes:[5,5]}},
  34. {id: 24, font:{size:30}, label: 'big box', shape: 'box' , shapeProperties:{borderDashes:[5,5]}},
  35. {id: 25, font:{size:30}, size:40, label: 'big diamond', shape: 'diamond', shapeProperties:{borderDashes:[5,5]}},
  36. {id: 26, font:{size:30}, size:40, label: 'big dot', shape: 'dot', shapeProperties:{borderDashes:[5,5]}},
  37. {id: 27, font:{size:30}, size:40, label: 'big square', shape: 'square', shapeProperties:{borderDashes:[5,5]}},
  38. {id: 28, font:{size:30}, size:40, label: 'big triangle',shape: 'triangle', shapeProperties:{borderDashes:[5,5]}},
  39. {id: 29, font:{size:30}, size:40, label: 'big triangleDown', shape: 'triangleDown', shapeProperties:{borderDashes:[5,5]}},
  40. {id: 30, font:{size:30}, label: 'big text', shape: 'text'},
  41. {id: 31, font:{size:30}, size:40, label: 'big star', shape: 'star', shapeProperties:{borderDashes:[5,5]}}
  42. ];
  43. edges = [
  44. ];
  45. // create a network
  46. var container = document.getElementById('mynetwork');
  47. var data = {
  48. nodes: nodes,
  49. edges: edges
  50. };
  51. var options = {physics:{barnesHut:{gravitationalConstant:-4000}}};
  52. network = new vis.Network(container, data, options);
  53. }
  54. </script>
  55. <script src="../../googleAnalytics.js"></script>
  56. <body onload="draw()">
  57. <p>
  58. Nodes can have all sorts of shapes. Note the exception where the nodes with text inside and the text type's size are determined by the font size, not the node size.
  59. </p>
  60. <div id="mynetwork"></div>
  61. <div id="info"></div>
  62. </body>
  63. </html>