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.

51 lines
1.6 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>Network | Multiline text</title>
  5. <style type="text/css">
  6. #mynetwork {
  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. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  14. <script type="text/javascript">
  15. function draw() {
  16. // create some nodes
  17. var nodes = [
  18. {id: 1, label: 'Node in\nthe center', shape: 'text'},
  19. {id: 2, label: 'Node\nwith\nmultiple\nlines', shape: 'circle'},
  20. {id: 3, label: 'This is a lot of text\nbut luckily we can spread\nover multiple lines', shape: 'database'},
  21. {id: 4, label: 'This is text\non multiple lines', shape: 'box'},
  22. {id: 5, label: 'Little text', shape: 'ellipse'}
  23. ];
  24. // create some edges
  25. var edges = [
  26. {from: 1, to: 2, style: 'line', color: 'red', width: 3, length: 200}, // individual length definition is possible
  27. {from: 1, to: 3, style: 'dash-line', width: 1, length: 200},
  28. {from: 1, to: 4, style: 'line', width: 1, length: 200, label:'I\'m an edge!'},
  29. {from: 1, to: 5, style: 'arrow', width: 3, length: 200, label:'arrows\nare cool'}
  30. ];
  31. // create a network
  32. var container = document.getElementById('mynetwork');
  33. var data = {
  34. nodes: nodes,
  35. edges: edges
  36. };
  37. var options = {};
  38. var network = new vis.Network(container, data, options);
  39. }
  40. </script>
  41. </head>
  42. <body onload="draw()">
  43. <div id="mynetwork"></div>
  44. </body>
  45. </html>