VivaGraphJS icon indicating copy to clipboard operation
VivaGraphJS copied to clipboard

Cannot run any example code

Open oldmonk101 opened this issue 8 years ago • 6 comments

Getting the same errors every time

vivagraph.js:1 Uncaught SyntaxError: Unexpected token < index_twit_viva.html:8 Uncaught ReferenceError: Viva is not defined

oldmonk101 avatar Apr 08 '16 02:04 oldmonk101

What is this file index_twit_viva.html?

anvaka avatar Apr 08 '16 05:04 anvaka

Sorry to miss that info. That is the same content as the demo - "01 - Create Graph.html"

oldmonk101 avatar Apr 08 '16 11:04 oldmonk101

The example works here: https://anvaka.github.io/VivaGraphJS/demos/tutorial_svg/01%20-%20Create%20Graph.html

Are you sure vivagraph is loaded on your page? Do you see any other errors in the developer console?

anvaka avatar Apr 09 '16 05:04 anvaka

No other error besides those two. I think the vivagraph is not loading, although the local path for the file vivagraph.js is correct.

oldmonk101 avatar Apr 09 '16 12:04 oldmonk101

I changed the line in demo to this -

Now the only error I am getting is this - index_twit_viva.html:10 Uncaught ReferenceError: Viva is not defined

main @ index_twit_viva.html:10 onload @ index_twit_viva.html:33

oldmonk101 avatar Apr 09 '16 13:04 oldmonk101

Just wondering, if this is a node app you just created, are you able to load in any other local JS files just fine? If you're using something like express, your app.js package should have something like this:


// Load static files (ie public/javascripts/*.js)
app.use(express.static(path.join(__dirname, 'public')));

Then you can put the vivagraph dist file in public/javascripts/vivagraph.js and be able to call it from your view template as : <script src="javascripts/vivagraph.js"></script>

I created a boilerplate repo that may help a bit: https://github.com/joerodrig3/vivagraph-boilerplate

joerodrig avatar Apr 11 '16 03:04 joerodrig