knowledge-graph.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <head>
  2. <meta charset="utf-8">
  3. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  4. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  5. <meta name="description" content="">
  6. <meta name="author" content="">
  7. <title>Sanlih Entertainment Television</title>
  8. <!-- Custom fonts for this template-->
  9. <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
  10. <link
  11. href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
  12. rel="stylesheet">
  13. <link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
  14. <!-- Custom styles for this template-->
  15. <link href="css/sb-admin-2.min.css" rel="stylesheet">
  16. <link href="css/custom.css" rel="stylesheet">
  17. <style>
  18. body {
  19. margin: 0;
  20. }
  21. </style>
  22. <script src="//unpkg.com/3d-force-graph"></script>
  23. <!--<script src="../../dist/3d-force-graph.js"></script>-->
  24. </head>
  25. <body>
  26. <nav class="navbar navbar-expand navbar-light bg-white topbar mb-2 static-top shadow">
  27. <!-- Sidebar - Brand -->
  28. <a class="sidebar-brand d-flex align-items-center justify-content-center" href="index.html">
  29. <div class="sidebar-brand-icon">
  30. <!-- <i class="fas fa-laugh-wink"></i> -->
  31. <img src="./img/iNEWS-logo.svg" width="120px" alt="">
  32. </div>
  33. <!-- <div class="sidebar-brand-text mx-3">TEXT-TO-CHART</div> -->
  34. </a>
  35. <!-- Sidebar Toggle (Topbar) -->
  36. <button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
  37. <i class="fa fa-bars"></i>
  38. </button>
  39. <!-- Topbar Navbar -->
  40. <ul class="navbar-nav ml-auto">
  41. <!-- Nav Item - Search Dropdown (Visible Only XS) -->
  42. <li class="nav-item dropdown no-arrow d-sm-none">
  43. <a class="nav-link dropdown-toggle" href="#" id="searchDropdown" role="button" data-toggle="dropdown"
  44. aria-haspopup="true" aria-expanded="false">
  45. <i class="fas fa-search fa-fw"></i>
  46. </a>
  47. <!-- Dropdown - Messages -->
  48. <div class="dropdown-menu dropdown-menu-right p-3 shadow animated--grow-in" aria-labelledby="searchDropdown">
  49. <form class="form-inline mr-auto w-100 navbar-search">
  50. <div class="input-group">
  51. <input type="text" class="form-control bg-light border-0 small" placeholder="Search for..."
  52. aria-label="Search" aria-describedby="basic-addon2">
  53. <div class="input-group-append">
  54. <button class="btn btn-primary" type="button">
  55. <i class="fas fa-search fa-sm"></i>
  56. </button>
  57. </div>
  58. </div>
  59. </form>
  60. </div>
  61. </li>
  62. <li class="nav-item"><a class="nav-link" href="./knowledge-graph.html">knowledge graph</a></li>
  63. <div class="topbar-divider d-sm-block"></div>
  64. <!-- Nav Item - User Information -->
  65. <li class="nav-item dropdown no-arrow">
  66. <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
  67. aria-haspopup="true" aria-expanded="false">
  68. <span class="mr-2 d-none d-lg-inline text-gray-600 small">User</span>
  69. <img class="img-profile rounded-circle" src="img/undraw_profile.svg">
  70. </a>
  71. </li>
  72. </ul>
  73. </nav>
  74. <div id="3d-graph"></div>
  75. <script type="importmap">{ "imports": { "three": "//unpkg.com/three/build/three.module.js" }}</script>
  76. <script type="module">
  77. import SpriteText from "//unpkg.com/three-spritetext/dist/three-spritetext.mjs";
  78. const Graph = ForceGraph3D()
  79. (document.getElementById('3d-graph'))
  80. .jsonUrl('./test.json')
  81. .nodeAutoColorBy('group')
  82. .nodeThreeObject(node => {
  83. const sprite = new SpriteText(node.id);
  84. sprite.material.depthWrite = false; // make sprite background transparent
  85. sprite.color = node.color;
  86. sprite.textHeight = 8;
  87. return sprite;
  88. });
  89. // Spread nodes a little wider
  90. Graph.d3Force('charge').strength(-120);
  91. </script>
  92. </body>