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.

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