simple-example.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Neovis.js Simple Example</title>
  5. <style type="text/css">
  6. html,
  7. body {
  8. font: 16pt arial;
  9. }
  10. #viz {
  11. width: 900px;
  12. height: 700px;
  13. border: 1px solid lightgray;
  14. font: 22pt arial;
  15. }
  16. </style>
  17. <!-- FIXME: load from dist -->
  18. <script type="text/javascript" src="../dist/neovis.js"></script>
  19. <script src="https://code.jquery.com/jquery-3.2.1.min.js"
  20. integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
  21. <script type="text/javascript">
  22. // define config car
  23. // instantiate nodevis object
  24. // draw
  25. var viz;
  26. function draw() {
  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. //"Character": "name",
  35. "Patent": {
  36. "caption": "patent_no"
  37. },
  38. "Inventor": {
  39. "caption": "inventor_name"
  40. }
  41. },
  42. relationships: {
  43. "HAS_CREATED": {
  44. "caption": true
  45. }
  46. },
  47. initial_cypher: "MATCH (n)-[r:HAS_CREATED]->(m) RETURN n,r,m LIMIT 25"
  48. };
  49. viz = new NeoVis.default(config);
  50. viz.render();
  51. console.log(viz);
  52. }
  53. </script>
  54. </head>
  55. <body onload="draw()">
  56. <div id="viz"></div>
  57. Cypher query: <textarea rows="4" cols=50 id="cypher"></textarea><br>
  58. <input type="submit" value="Submit" id="reload">
  59. <input type="submit" value="Stabilize" id="stabilize">
  60. </body>
  61. <script>
  62. $("#reload").click(function () {
  63. var cypher = $("#cypher").val();
  64. if (cypher.length > 3) {
  65. viz.renderWithCypher(cypher);
  66. } else {
  67. console.log("reload");
  68. viz.reload();
  69. }
  70. });
  71. $("#stabilize").click(function () {
  72. viz.stabilize();
  73. })
  74. </script>
  75. </html>