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
2.0 KiB

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script>
  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>