Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <title>Neovis.js Simple Example</title>
- <style type="text/css">
- html, body {
- font: 16pt arial;
- }
- #viz {
- width: 1500px;
- 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://rawgit.com/neo4j-contrib/neovis.js/master/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://localhost:7687",
- server_user: "neo4j",
- server_password: "test",
- labels: {
- //"Character": "name",
- "Skill": {
- "caption": "name",
- "size": "skill_rank",
- "community": "skill_type"
- //"sizeCypher": "MATCH (n) WHERE id(n) = {id} MATCH (n)-[r]-() RETURN sum(r.weight) AS c"
- }
- },
- relationships: {
- "CO_OCCURS": {
- "thickness": "weight",
- "caption": false
- }
- },
- initial_cypher: "MATCH (n)-[r:CO_OCCURS]->(m) RETURN n,r,m"
- };
- viz = new NeoVis.default(config);
- viz.render();
- viz.stabilize();
- 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">
- <input type="submit" value="Stabilize" id="stabilize">
- </body>
- <script>
- $("#reload").click(function() {
- var cypher = $("#cypher").val();
- if (cypher.length > 3) {
- viz.renderWithCypher(cypher);
- } else {
- console.log("reload");
- viz.reload();
- viz.stabilize();
- }
- });
- $("#stabilize").click(function() {
- viz.stabilize();
- })
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement