-1

I'm trying to display a graph from json film went from NEO4J db. But it shows a blank page and in the console it shows an error. Here output: enter image description here Here the code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/alchemyjs/0.4.2/styles/vendor.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/alchemyjs/0.4.2/scripts/vendor.js"></script>
    <script src="lodash.js"></script>

</head>
<body>
<div class="alchemy" id="alchemy"></div>
<script type="text/javascript">
    alchemy.begin({
        dataSource: "../result.json",
        dataType:'html',
        nodeCaption:'name',
        nodeMouseOver:'name',
        cluster: true,
        clusterColours:["#1B9E77,#D95F02,#7570B3,#E7298A,#66A61E,#E6AB02"]
    })
</script>
</body>
</html>
Andrea Perelli
  • 156
  • 2
  • 3
  • 14

1 Answers1

1

I dont think that's the way to initialize the library. modify your script to

<script type="text/javascript">
   var config ={
        dataSource: "../result.json",
        dataType:'html',
        nodeCaption:'name',
        nodeMouseOver:'name',
        cluster: true,
        clusterColours:["#1B9E77,#D95F02,#7570B3,#E7298A,#66A61E,#E6AB02"]
    };
     alchemy = new Alchemy(config);
</script>

Referencce http://graphalchemist.github.io/Alchemy/#/examples

It looks like you are not loading the alchemyjs. you are loading only the dependency for alchemyjs. Include both the scripts

 <script src="https://cdnjs.cloudflare.com/ajax/libs/alchemyjs/0.4.2/scripts/vendor.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/alchemyjs/0.4.2/alchemy.min.js"></script>
karthick
  • 11,998
  • 6
  • 56
  • 88
  • First thank you for the answer, I modified the code like you said me, but I have one error " ReferenceError: Can't find variable: Alchemy". – Andrea Perelli May 29 '17 at 19:52
  • You are not loading the library you are loading a vendor script that is used by the library. use http://cdn.graphalchemist.com/alchemy.min.js. I have updated my answer – karthick May 29 '17 at 19:56
  • I'm sorry, but don't work, I had already tried it. Now give me two errors: "[Error] SyntaxError: Unexpected token '<' (anonymous function) (alchemy.min.js:1) [Error] ReferenceError: Can't find variable: Alchemy Global Code (index.html:22)" – Andrea Perelli May 29 '17 at 20:00
  • my bad the reference link still didn't load all the dependencies. Can you try including the vendor script first and then the alchmey script. I have updated the answer – karthick May 29 '17 at 20:07
  • No probem have a nice day – karthick May 29 '17 at 20:13