Skip to content

Instantly share code, notes, and snippets.

@MHenderson
Last active November 4, 2021 09:57
Show Gist options
  • Save MHenderson/9767470 to your computer and use it in GitHub Desktop.
Save MHenderson/9767470 to your computer and use it in GitHub Desktop.
Minimal example of vis.js (visjs.org).
<!doctype html>
<html>
<head>
<title>vis.js Graph demo</title>
<script src="http://visjs.org/dist/vis.js"></script>
<link href="http://visjs.org/dist/vis.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="graph"></div>
<script type="text/javascript">
var nodes = [
{id: 1, label: 'a'},
{id: 2, label: 'b'},
{id: 3, label: 'c'},
];
var edges = [
{from: 1, to: 2},
{from: 1, to: 3},
{from: 2, to: 3},
];
var container = document.getElementById('graph');
var data = {
nodes: nodes,
edges: edges,
};
var graph = new vis.Graph(container, data, {});
</script>
</body>
</html>
@mdhasanai
Copy link

Does not working

@pariswells
Copy link

pariswells commented Aug 11, 2018

Found this does not like to hosted from http://visjs.org/dist/

Download vss.css and vis.min.js to your hosting and it works OK

@amorigoye
Copy link

Hello I found your work very very useful to me since I have been trying to produce something similar. Was excited when I saw this post. However, when I copied and pasted the code in a notepad editor and tried to open it in my google chrome browser, it showed a blank page. Please kindly guide me or help me find out what I did wrong. Thank you very much

@cdanielgomes
Copy link

if you use vis.Network(container, data, {}) it will work

@MHenderson
Copy link
Author

thanks @cdanielgomes

@MHenderson
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment