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.

98 lines
2.2 KiB

  1. <!doctype html>
  2. <!-- saved from url=(0044)http://kenedict.com/networks/worldcup14/vis/ , thanks Andre!-->
  3. <html>
  4. <head>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF8">
  6. <title>Network | Static smooth curves - World Cup Network</title>
  7. <script type="text/javascript" src="../../../dist/vis.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../../../dist/vis-network.min.css">
  9. <script src="../datasources/WorldCup2014.js"></script>
  10. <style type="text/css">
  11. #mynetwork {
  12. width: 800px;
  13. height: 800px;
  14. border: 1px solid lightgray;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <h2>Performance - World Cup Network</h2>
  20. <div style="width:700px; font-size:14px;">
  21. This example shows the performance of vis with a larger network. The edges in
  22. particular (~9200) are very computationally intensive
  23. to draw. Drag and hold the graph to see the performance difference if the
  24. edges are hidden.
  25. <br/><br/>
  26. We use the following physics configuration: <br/>
  27. <code>{barnesHut: {gravitationalConstant: -80000, springConstant: 0.001,
  28. springLength: 200}}</code>
  29. <br/><br/>
  30. </div>
  31. <div id="mynetwork"></div>
  32. <script type="text/javascript">
  33. var network;
  34. function redrawAll() {
  35. // remove positoins
  36. for (var i = 0; i < nodes.length; i++) {
  37. delete nodes[i].x;
  38. delete nodes[i].y;
  39. }
  40. // create a network
  41. var container = document.getElementById('mynetwork');
  42. var data = {
  43. nodes: nodes,
  44. edges: edges
  45. };
  46. var options = {
  47. nodes: {
  48. shape: 'dot',
  49. scaling: {
  50. min: 10,
  51. max: 30
  52. },
  53. font: {
  54. size: 12,
  55. face: 'Tahoma'
  56. }
  57. },
  58. edges: {
  59. width: 0.15,
  60. color: {inherit: 'from'},
  61. smooth: {
  62. type: 'continuous'
  63. }
  64. },
  65. physics: {
  66. stabilization: false,
  67. barnesHut: {
  68. gravitationalConstant: -80000,
  69. springConstant: 0.001,
  70. springLength: 200
  71. }
  72. },
  73. interaction: {
  74. tooltipDelay: 200,
  75. hideEdgesOnDrag: true
  76. }
  77. };
  78. // Note: data is coming from ./datasources/WorldCup2014.js
  79. network = new vis.Network(container, data, options);
  80. }
  81. redrawAll()
  82. </script>
  83. </body>
  84. </html>