Skip to content

Instantly share code, notes, and snippets.

@zommarin
Created February 23, 2018 15:42
Show Gist options
  • Save zommarin/2630621bb8a8e99e7c13261a4787a1b4 to your computer and use it in GitHub Desktop.
Save zommarin/2630621bb8a8e99e7c13261a4787a1b4 to your computer and use it in GitHub Desktop.
Simple vis.js example
<!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>
<h1>TEST</h1>
<div id="graph" style="width: available; height: 1000px"></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,
};
console.log(vis)
var graph = new vis.Network(container, data, {});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment