vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

78 lines
2.9 KiB

<!doctype html>
<html>
<head>
<title>Graph | Social Network</title>
<style>
body {
font: 10pt arial;
}
</style>
<script type="text/javascript" src="../../vis.js"></script>
<script type="text/javascript">
var DIR = 'img/soft-scraps-icons/';
var nodes = null;
var edges = null;
var graph = null;
function draw() {
// create people
nodes = [
{id: 1, text: 'Algie', image: DIR + 'Smiley-Angry-icon.png', style: 'image'},
{id: 2, text: 'Alston', image: DIR + 'Smiley-Grin-icon.png', style: 'image'},
{id: 3, text: 'Barney', image: DIR + 'User-Administrator-Blue-icon.png', style: 'image'},
{id: 4, text: 'Coley', image: DIR + 'User-Administrator-Green-icon.png', style: 'image'},
{id: 5, text: 'Grant', image: DIR + 'User-Coat-Blue-icon.png', style: 'image'},
{id: 6, text: 'Langdon', image: DIR + 'User-Coat-Green-icon.png', style: 'image'},
{id: 7, text: 'Lee', image: DIR + 'User-Coat-Red-icon.png', style: 'image'},
{id: 8, text: 'Merlin', image: DIR + 'User-Executive-Green-icon.png', style: 'image'},
{id: 9, text: 'Mick', image: DIR + 'User-Preppy-Blue-icon.png', style: 'image'},
{id: 10, text: 'Tod', image: DIR + 'User-Preppy-Red-icon.png', style: 'image'}
];
// create connections
var color = '#BFBFBF';
edges = [
{from: 2, to: 8, value: 3, color: color},
{from: 2, to: 9, value: 5, color: color},
{from: 2, to: 10, value: 1, color: color},
{from: 4, to: 6, value: 8, color: color},
{from: 5, to: 7, value: 2, color: color},
{from: 4, to: 5, value: 1, color: color},
{from: 9, to: 10, value: 2, color: color},
{from: 2, to: 3, value: 6, color: color},
{from: 3, to: 9, value: 4, color: color},
{from: 5, to: 3, value: 1, color: color},
{from: 2, to: 7, value: 4, color: color}
];
// create a graph
var container = document.getElementById('mygraph');
var data = {
nodes: nodes,
edges: edges
};
var options = {
width: '600px',
height: '600px',
backgroundColor: {
fill: '#F3F3F3'
}
};
graph = new vis.Graph(container, data, options);
}
</script>
</head>
<body onload="draw()">
<div id="mygraph"></div>
<p>
Icons: <a href="http://www.deleket.com/" target="_blank">Scrap Icons by Deleket</a>
</p>
<div id="info"></div>
</body>
</html>