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.

35 lines
814 B

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Graph | DOT Language</title>
  5. <script type="text/javascript" src="../../vis.js"></script>
  6. <style type="text/css">
  7. html, body, #mygraph {
  8. width: 100%;
  9. height: 100%;
  10. padding: 0;
  11. margin: 0;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <div id="mygraph"></div>
  17. <script type="text/javascript">
  18. // parse data in DOT-notation
  19. var dot = 'digraph {node[shape=circle]; 1 -> 1 -> 2; 2 -> 3; 2 -- 4; 2 -> 1 }';
  20. var data = vis.util.DOTToGraph(dot);
  21. // create a graph
  22. var container = document.getElementById('mygraph');
  23. var graph = new vis.Graph(container, data);
  24. // resize the network when window resizes
  25. window.onresize = function () {
  26. graph.redraw()
  27. };
  28. </script>
  29. </body>
  30. </html>