design.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1">
  5. <style type="text/css">
  6. html,
  7. body,
  8. input,
  9. textarea {
  10. font: 10pt arial;
  11. }
  12. /* #viz {
  13. width: 75%;
  14. height: 700px;
  15. border: 1px solid lightgray;
  16. font: 22pt arial;
  17. margin: 10px;
  18. } */
  19. label {
  20. display: inline-block;
  21. width: 10em;
  22. }
  23. * {
  24. box-sizing: border-box;
  25. }
  26. .column {
  27. float: left;
  28. width: 33.33%;
  29. padding: 10px;
  30. }
  31. .row:after {
  32. content: "";
  33. display: table;
  34. clear: both;
  35. }
  36. ul {
  37. list-style-type: none;
  38. margin: 0;
  39. padding: 0;
  40. width: 200px;
  41. background-color: #f1f1f1;
  42. }
  43. li a {
  44. display: block;
  45. color: #000;
  46. padding: 8px 16px;
  47. text-decoration: none;
  48. }
  49. /* Change the link color on hover */
  50. li a:hover {
  51. background-color: #555;
  52. color: white;
  53. }
  54. </style>
  55. </head>
  56. <body>
  57. <div class="row">
  58. <div class="column">
  59. <ul>
  60. <li><a href="#patents">Patents</a></li>
  61. <li><a href="#experts">Experts</a></li>
  62. <li><a href="#parties">Parties</a></li>
  63. <li><a href="#inventor">Inventor</a></li>
  64. <li><a href="#attorneys">Attorneys</a></li>
  65. <li><a href="#firm">Firm</a></li>
  66. </ul>
  67. </div>
  68. <div class="column">
  69. <h2>Graph</h2>
  70. </div>
  71. <div class="column">
  72. <div>
  73. <div>
  74. <h3>Connection Details:</h3>
  75. <label for="url">URL</label><input id="url" name="url" type="text"
  76. value="bolt://localhost:7687" /><br />
  77. <label for="user">Username</label><input id="user" name="user" type="text" value="neo4j" /><br />
  78. <label for="pass">Password</label><input id="pass" name="pass" type="password" value="test" />
  79. </div>
  80. <div>
  81. <h3>Styling Nodes:</h3>
  82. <label for="label">Node-Label</label><input id="label" name="label" type="text"
  83. value="Character" /><br />
  84. <label for="caption">Label</label><input id="caption" name="caption" type="text"
  85. value="name" /><br />
  86. <label for="size">Size</label><input id="size" name="size" type="text" value="pagerank" /><br />
  87. <label for="color">Color</label><input id="community" name="community" type="text"
  88. value="community" />
  89. </div>
  90. <div>
  91. <h3>Styling Relationship:</h3>
  92. <label for="type">Relationship-Type</label><input id="type" name="type" type="text"
  93. value="INTERACTS" /><br />
  94. <label for="thickness">Thickness</label><input id="thickness" name="thickness" type="text"
  95. value="weight" /><br />
  96. <label for="rel_caption">Caption</label><input id="rel_caption" name="rel_caption" type="text"
  97. value="" />
  98. </div>
  99. <div>
  100. <h3>Cypher query: </h3>
  101. <textarea rows="4" cols=50 id="cypher">MATCH (n)-[r:INTERACTS]->(m) RETURN n,r,m</textarea><br>
  102. <input type="submit" value="Submit" id="reload">
  103. <input type="submit" value="Stabilize" id="stabilize">
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <div>
  109. <div id="viz"></div>
  110. Cypher query: <textarea rows="4" cols=50 id="cypher"></textarea><br>
  111. <input type="submit" value="Submit" id="reload">
  112. <input type="submit" value="Stabilize" id="stabilize">
  113. </div>
  114. <script>
  115. $(document).ready(function () {
  116. draw();
  117. })
  118. $("#reload").click(function () {
  119. draw();
  120. /*
  121. var cypher = $("#cypher").val();
  122. if (cypher.length > 3) {
  123. viz.renderWithCypher(cypher);
  124. } else {
  125. console.log("reload");
  126. viz.reload();
  127. }
  128. */
  129. });
  130. $("#stabilize").click(function () {
  131. viz.stabilize();
  132. })
  133. </script>
  134. <script type="text/javascript">
  135. var viz;
  136. function draw() {
  137. var config = {
  138. container_id: "viz",
  139. server_url: $("#url").val(),
  140. server_user: $("#user").val(),
  141. server_password: $("#pass").val(),
  142. labels: {},
  143. relationships: {},
  144. initial_cypher: $("#cypher").val()
  145. };
  146. config.labels[$("#label").val()] = {
  147. "caption": $("#caption").val(),
  148. "size": $("#size").val(),
  149. "community": $("#community").val(),
  150. //"sizeCypher": "MATCH (n) WHERE id(n) = {id} MATCH (n)-[r]-() RETURN sum(r.weight) AS c"
  151. };
  152. config.relationships[$("#rel_type").val()] = {
  153. "thickness": $("#thickness").val(),
  154. "caption": $("#rel_caption").val(),
  155. }
  156. viz = new NeoVis.default(config);
  157. viz.render();
  158. console.log(viz);
  159. }
  160. </script>
  161. <script src="https://cdn.neo4jlabs.com/neovis.js/master/neovis.js"></script>
  162. <script src="https://code.jquery.com/jquery-3.2.1.min.js"
  163. integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
  164. </body>
  165. </html>