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.

93 lines
3.0 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Vis Popup Example</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 src="../dist/vis.js" type="text/javascript" ></script>
  16. <link href="../dist/vis.css" rel="stylesheet" type="text/css"/>
  17. <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  18. <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  19. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" type="text/javascript"></script>
  20. <script type="text/javascript">
  21. var network = null;
  22. var network2 = null;
  23. function draw() {
  24. var nodes = [];
  25. var edges = [];
  26. nodes.push({ id: 1, label: 'Node1' });
  27. nodes.push({ id: 2, label: 'Node2' });
  28. edges.push({ from: 2, to: 1 });
  29. var data = {
  30. nodes: nodes,
  31. edges: edges
  32. };
  33. // create a network
  34. var container = document.getElementById('mynetwork');
  35. var options = {
  36. layout: {
  37. hierarchical: {
  38. direction: "UD"
  39. }
  40. }
  41. };
  42. network = new vis.Network(container, data, options);
  43. $('#divTreemapPopUp').modal('show');
  44. //
  45. // var nodes2 = [];
  46. // var edges2 = [];
  47. // nodes2.push({ id: 1, label: 'Node1' });
  48. // nodes2.push({ id: 2, label: 'Node2' });
  49. // edges2.push({ from: 2, to: 1 });
  50. //
  51. // var data2 = {
  52. // nodes: nodes2,
  53. // edges: edges2
  54. // };
  55. //
  56. // // create a network
  57. // var container2 = document.getElementById('mynetwork2');
  58. // var options2 = {
  59. // layout: {
  60. // hierarchical: {
  61. // direction: "UD"
  62. // }
  63. // }
  64. // };
  65. // network2 = new vis.Network(container2, data2, options2);
  66. // setTimeout(function() {console.log('redraw');network.redraw()},1000)
  67. }
  68. </script>
  69. </head>
  70. <body onload="draw();">
  71. <h2>Popup Example</h2>
  72. <div style='display: none;' class='modal fade' id='divTreemapPopUp' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
  73. <div class='modal-dialog'><div class='modal-content'><div class='modal-header'>
  74. <button type='button' class='close' data-dismiss='modal' aria-hidden='true'></button>
  75. <h4 class='modal-title'>TreeMap</h4></div>
  76. <div class='modal-body'>
  77. <div id='mynetwork'></div></div>
  78. <div class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>Close</button></div></div></div></div>
  79. <div id='mynetwork2'></div>
  80. </body>
  81. </html>