123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <!doctype html>
- <html>
- <head>
- <title>Neovis.js Simple Example</title>
- <style type="text/css">
- html, body {
- font: 16pt arial;
- }
- #viz {
- width: 900px;
- height: 700px;
- border: 1px solid lightgray;
- font: 22pt arial;
- }
- </style>
- <!-- FIXME: load from dist -->
- <script type="text/javascript" src="../dist/neovis.js"></script>
- <script
- src="https://code.jquery.com/jquery-3.2.1.min.js"
- integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
- crossorigin="anonymous"></script>
- <script type="text/javascript">
- // define config car
- // instantiate nodevis object
- // draw
- var viz;
- function draw() {
- var config = {
- container_id: "viz",
- server_url: "bolt://54.209.44.254:33146",
- server_user: "neo4j",
- server_password: "investigators-spill-future",
- labels: {
- //"Character": "name",
- "Person": {
- "caption": "name",
- "size": 1.0,
- "sizeCypher": "MATCH (n) WHERE id(n) = {id} RETURN SIZE((n)--()) AS s;",
- "icon": "????"
- },
- "Organization": {
- "caption": "name",
- "size": 2.0,
- "sizeCypher": "MATCH (n) WHERE id(n) = {id} RETURN SIZE((n)--()) AS s",
- "icon": "???"
- }
- },
- relationships: {
- "PRESIDENT": {
- "caption": "El Presidente"
- }
- },
- initial_cypher: "match (p:Person)-[r]-(o:Organization)-[r1]-(p2:Person) RETURN * LIMIT 10",
- arrows: false
- };
- viz = new NeoVis.default(config);
- viz.render();
- console.log(viz);
- }
- </script>
- </head>
- <body onload="draw()">
- <div id="viz"></div>
- Cypher query: <textarea rows="4" cols=50 id="cypher"></textarea><br>
- <input type="submit" value="Submit" id="reload">
- </body>
- <script>
- $("#reload").click(function() {
- var cypher = $("#cypher").val();
- if (cypher.length > 3) {
- viz.renderWithCypher(cypher);
- } else {
- console.log("reload");
- viz.reload();
- }
- });
- </script>
- </html>
|