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.

50 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. <style type="text/css">
  6. #mygraph {
  7. width: 600px;
  8. height: 600px;
  9. border: 1px solid lightgray;
  10. }
  11. </style>
  12. <script type="text/javascript" src="../../dist/vis.js"></script>
  13. <script type="text/javascript">
  14. function draw() {
  15. // create some nodes
  16. var nodes = [
  17. {id: 1, label: 'Node in\nthe center', shape: 'text'},
  18. {id: 2, label: 'Node\nwith\nmultiple\nlines', shape: 'circle'},
  19. {id: 3, label: 'This is a lot of text\nbut luckily we can spread\nover multiple lines', shape: 'database'},
  20. {id: 4, label: 'This is text\non multiple lines', shape: 'box'},
  21. {id: 5, label: 'Little text', shape: 'ellipse'}
  22. ];
  23. // create some edges
  24. var edges = [
  25. {from: 1, to: 2, style: 'line', color: 'red', width: 3, length: 200},
  26. {from: 1, to: 3, style: 'dash-line', width: 1, length: 200},
  27. {from: 1, to: 4, style: 'line', width: 1, length: 200},
  28. {from: 1, to: 5, style: 'arrow', width: 3, length: 200}
  29. ];
  30. // create a graph
  31. var container = document.getElementById('mygraph');
  32. var data = {
  33. nodes: nodes,
  34. edges: edges
  35. };
  36. var options = {};
  37. var graph = new vis.Graph(container, data, options);
  38. }
  39. </script>
  40. </head>
  41. <body onload="draw()">
  42. <div id="mygraph"></div>
  43. </body>
  44. </html>