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.

42 lines
1.5 KiB

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>Graph | Multiline text</title>
  5. <script type="text/javascript" src="../../vis.js"></script>
  6. <script type="text/javascript">
  7. function draw() {
  8. // create some nodes
  9. var nodes = [
  10. {id: 1, label: 'Node in\nthe center', shape: 'text'},
  11. {id: 2, label: 'Node\nwith\nmultiple\nlines', shape: 'circle'},
  12. {id: 3, label: 'This is a lot of text\nbut luckily we can spread\nover multiple lines', shape: 'database'},
  13. {id: 4, label: 'This is text\non multiple lines', shape: 'box'},
  14. {id: 5, label: 'Little text', shape: 'ellipse'}
  15. ];
  16. // create some edges
  17. var edges = [
  18. {from: 1, to: 2, style: 'line', color: 'red', width: 3, length: 200},
  19. {from: 1, to: 3, style: 'dash-line', width: 1, length: 200},
  20. {from: 1, to: 4, style: 'line', width: 1, length: 200},
  21. {from: 1, to: 5, style: 'arrow', width: 3, length: 200}
  22. ];
  23. // create a graph
  24. var container = document.getElementById('mygraph');
  25. var data = {
  26. nodes: nodes,
  27. edges: edges
  28. };
  29. var options = {};
  30. var graph = new vis.Graph(container, data, options);
  31. }
  32. </script>
  33. </head>
  34. <body onload="draw()">
  35. <div id="mygraph"></div>
  36. </body>
  37. </html>