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.

95 lines
2.6 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="../dist/vis.js"></script>
  5. <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.9.0/vis.min.css">
  6. <style>
  7. #mynetwork {
  8. width: 1400px;
  9. height: 800px;
  10. border: 1px solid gray;
  11. }
  12. </style>
  13. </head>
  14. <body onload="draw();">
  15. <script src="https://rawgit.com/Tooa/6e17f2d7b8e34ef94719/raw/a10096a6b88c992c57d032b1ed3079d7cc4b1f51/data.js"></script>
  16. <div id="mynetwork"></div>
  17. <script>
  18. for (var i = 0; i < nodes.length; i++) {
  19. nodes[i].mass = Math.ceil(2000* nodes[i].value);
  20. }
  21. var nodesDataset = new vis.DataSet(nodes);
  22. var edgesDataset = new vis.DataSet(edges);
  23. function redrawAll() {
  24. var container = document.getElementById('mynetwork');
  25. var options = {
  26. nodes: {
  27. borderWidth:4,
  28. color: {
  29. border: '#406897',
  30. background: '#6AAFFF'
  31. },
  32. scaling: {
  33. min: 10,
  34. max: 200,
  35. label: {
  36. min: 50,
  37. max: 100,
  38. drawThreshold: 10,
  39. maxVisible: 60
  40. }
  41. },
  42. font: {
  43. size: 20,
  44. color:'#000000'
  45. },
  46. shapeProperties: {
  47. useBorderWithImage: true
  48. },
  49. },
  50. edges: {
  51. scaling: {
  52. min: 2,
  53. max: 50
  54. },
  55. color: { inherit: 'from' },
  56. smooth: {
  57. type: 'continuous'
  58. }
  59. },
  60. physics: {
  61. "barnesHut": {
  62. "gravitationalConstant": -19050,
  63. "centralGravity": 1.3,
  64. "springLength": 170,
  65. "springConstant": 0.035,
  66. "damping": 0.23
  67. },
  68. "minVelocity": 0.75,
  69. stabilization: {
  70. enabled: false,
  71. iterations: 2000,
  72. updateInterval: 25
  73. }
  74. },
  75. configure:'physics',
  76. interaction: {
  77. tooltipDelay: 200,
  78. hideEdgesOnDrag: true
  79. },
  80. layout:{improvedLayout:false}
  81. };
  82. network = new vis.Network(container, {nodes: nodesDataset, edges: edgesDataset}, options);
  83. }
  84. redrawAll();
  85. </script>
  86. </body>
  87. </html>