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.
 
 
 

57 lines
1.2 KiB

<!doctype html>
<html>
<head>
<title>Network | Basic usage</title>
<script type="text/javascript" src="../dist/vis.js"></script>
<link href="../dist/vis.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#mynetwork {
width: 600px;
height: 400px;
border: 1px solid lightgray;
}
</style>
</head>
<body>
<p>
Create a simple network with some nodes and edges.
</p>
<div id="mynetwork"></div>
<script type="text/javascript">
// create an array with nodes
var nodes = new vis.DataSet([
{id: 1, label: 'N1'},
{id: 2, label: 'N2'}
]);
var edges = new vis.DataSet([
{id: '1%2', from: 1, to: 2},
{id: '2%1',from: 2, to: 1}
]);
var container = document.getElementById('mynetwork');
var data = {
nodes: nodes,
edges: edges
};
var options = {edges:{arrows:'to'}};
var network = new vis.Network(container, data, options);
edges.update({id: '1%2', arrows:{from:{enabled:true}}});
edges.update({id: '1%2', arrows: null});
//
// edges.update({id: '1%2', width: 20});
// also try after:
// edges.update({id: '2%1', color: '#00ff00'});
</script>
</body>
</html>