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.

52 lines
1.6 KiB

  1. <!doctype html>
  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', font:{strokeWidth:4}},
  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, color: 'red', width: 3, length: 200}, // individual length definition is possible
  27. {from: 1, to: 3, dashes:true, width: 1, length: 200},
  28. {from: 1, to: 4, width: 1, length: 200, label:'I\'m an edge!'},
  29. {from: 1, to: 5, arrows:'to', 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. <script src="../../googleAnalytics.js"></script>
  42. </head>
  43. <body onload="draw()">
  44. <div id="mynetwork"></div>
  45. </body>
  46. </html>