Advertisement
Guest User

Untitled

a guest
Nov 5th, 2019
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Neovis.js Simple Example</title>
  5. <style type="text/css">
  6. html, body {
  7. font: 16pt arial;
  8. }
  9. #viz {
  10. width: 1500px;
  11. height: 700px;
  12. border: 1px solid lightgray;
  13. font: 22pt arial;
  14. }
  15. </style>
  16.  
  17. <!-- FIXME: load from dist
  18. <script type="text/javascript" src="../dist/neovis.js"></script>
  19. -->
  20. <script src="https://rawgit.com/neo4j-contrib/neovis.js/master/dist/neovis.js"></script>
  21.  
  22. <script
  23. src="https://code.jquery.com/jquery-3.2.1.min.js"
  24. integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
  25. crossorigin="anonymous"></script>
  26.  
  27. <script type="text/javascript">
  28. // define config car
  29. // instantiate nodevis object
  30. // draw
  31. var viz;
  32. function draw() {
  33. var config = {
  34. container_id: "viz",
  35. server_url: "bolt://localhost:7687",
  36. server_user: "neo4j",
  37. server_password: "test",
  38. labels: {
  39. //"Character": "name",
  40. "Skill": {
  41. "caption": "name",
  42. "size": "skill_rank",
  43. "community": "skill_type"
  44. //"sizeCypher": "MATCH (n) WHERE id(n) = {id} MATCH (n)-[r]-() RETURN sum(r.weight) AS c"
  45. }
  46. },
  47. relationships: {
  48. "CO_OCCURS": {
  49. "thickness": "weight",
  50. "caption": false
  51. }
  52. },
  53. initial_cypher: "MATCH (n)-[r:CO_OCCURS]->(m) RETURN n,r,m"
  54. };
  55. viz = new NeoVis.default(config);
  56. viz.render();
  57. viz.stabilize();
  58. console.log(viz);
  59. }
  60. </script>
  61. </head>
  62. <body onload="draw()">
  63. <div id="viz"></div>
  64.  
  65.  
  66. Cypher query: <textarea rows="4" cols=50 id="cypher"></textarea><br>
  67. <input type="submit" value="Submit" id="reload">
  68. <input type="submit" value="Stabilize" id="stabilize">
  69.  
  70.  
  71. </body>
  72.  
  73. <script>
  74. $("#reload").click(function() {
  75. var cypher = $("#cypher").val();
  76. if (cypher.length > 3) {
  77. viz.renderWithCypher(cypher);
  78. } else {
  79. console.log("reload");
  80. viz.reload();
  81. viz.stabilize();
  82. }
  83. });
  84. $("#stabilize").click(function() {
  85. viz.stabilize();
  86. })
  87. </script>
  88. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement