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.

69 lines
1.6 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Network | Arrows</title>
  5. <style type="text/css">
  6. body {
  7. font: 10pt sans;
  8. }
  9. #mynetwork {
  10. width: 600px;
  11. height: 600px;
  12. border: 1px solid lightgray;
  13. }
  14. </style>
  15. <script type="text/javascript" src="../../dist/vis.js"></script>
  16. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  17. <script type="text/javascript">
  18. // Called on page load
  19. function draw() {
  20. var nodes = [
  21. {id: 1, label: 'arrows\nexamples'},
  22. {id: 2, label: 'none'},
  23. {id: 3, label: '"to"'},
  24. {id: 4, label: '"from, to"'},
  25. {id: 5, label: '"middle"'},
  26. {id: 6, label: '{to: {scaleFactor: 2}}'}
  27. ];
  28. var edges = [
  29. {from: 1, to: 2},
  30. {from: 1, to: 3, arrows: 'to'},
  31. {from: 1, to: 4, arrows: 'from, to'},
  32. {from: 1, to: 5, arrows: 'middle'},
  33. {from: 1, to: 6, arrows: {to: {scaleFactor: 2}}}
  34. ];
  35. // create the network
  36. var container = document.getElementById('mynetwork');
  37. var data = {
  38. nodes: nodes,
  39. edges: edges
  40. };
  41. var options = {
  42. nodes: {
  43. shape: 'box'
  44. },
  45. physics: {
  46. barnesHut: {
  47. springLength: 150
  48. },
  49. stabilization: false
  50. }
  51. };
  52. var network = new vis.Network(container, data, options);
  53. }
  54. </script>
  55. <script src="../googleAnalytics.js"></script>
  56. </head>
  57. <body onload="draw();">
  58. <p>
  59. This example shows the different options for arrows.
  60. </p>
  61. <div id="mynetwork"></div>
  62. </body>
  63. </html>