new_example.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>
  6. Patents View neo4j
  7. </title>
  8. <style type="text/css">
  9. html,
  10. body {
  11. font: 16pt arial;
  12. }
  13. #viz {
  14. width: 900px;
  15. height: 700px;
  16. border: 1px solid lightgray;
  17. font: 22pt arial;
  18. }
  19. </style>
  20. <link href="style.css" rel="stylesheet" />
  21. <script src="http://code.jquery.com/jquery-2.0.3.min.js" data-semver="2.0.3" data-require="jquery"></script>
  22. <script src="https://rawgit.com/neo4j-contrib/neovis.js/master/dist/neovis.js"></script>
  23. <script type="text/javascript">
  24. var viz;
  25. function draw() {
  26. // alert("inside method");
  27. var config = {
  28. container_id: "viz",
  29. server_url: "bolt://50.211.199.151:7687",
  30. server_user: "neo4j",
  31. server_password: "test",
  32. arrows: true,
  33. labels: {
  34. "Patent": {
  35. "caption": "patent_no"
  36. },
  37. "Application": {
  38. "caption": "application_no"
  39. }
  40. },
  41. relationships: {
  42. },
  43. initial_cypher: "MATCH (n)-[r:CITES]->(m) RETURN n,r,m LIMIT 25"
  44. };
  45. viz = new NeoVis.default(config);
  46. console.log(JSON.stringify(viz));
  47. viz.render();
  48. console.log(viz)
  49. }
  50. </script>
  51. </head>
  52. <body onload="draw()">
  53. <div id="viz"></div>
  54. Cypher query: <textarea rows="4" cols=50 id="cypher"></textarea><br>
  55. <input type="submit" value="Submit" id="reload">
  56. <input type="submit" value="Stabilize" id="stabilize">
  57. </body>
  58. <script>
  59. $("#reload").click(function () {
  60. var cypher = $("#cypher").val();
  61. if (cypher.length > 3) {
  62. viz.renderWithCypher(cypher);
  63. } else {
  64. console.log("reload");
  65. viz.reload();
  66. }
  67. });
  68. $("#stabilize").click(function () {
  69. viz.stabilize();
  70. })
  71. </script>
  72. <!--
  73. <body>
  74. <div>
  75. <div id="row2">
  76. <input type="button" value="click" onclick="draw()">
  77. <div id="viz"></div>
  78. </div>
  79. </form>
  80. </div>
  81. </body>
  82. </html>
  83. -->