<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>Network | Basic usage</title>
|
|
|
|
<script type="text/javascript" src="../../../dist/vis.js"></script>
|
|
<link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" />
|
|
|
|
<style type="text/css">
|
|
#mynetwork {
|
|
width: 600px;
|
|
height: 400px;
|
|
border: 1px solid lightgray;
|
|
}
|
|
|
|
p {
|
|
max-width:800px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<p>
|
|
There are a lot of options with colors. You can manually define a color or inherit the color from the nodes. You can set the opacity
|
|
to override any opacity given by a color. <b>IN ORDER TO USE THE OPACITY, BOTH THE NODES AND THE EDGES NEED COLORS IN HEX OR RGB</b>!
|
|
</p>
|
|
|
|
<div id="mynetwork"></div>
|
|
|
|
<script type="text/javascript">
|
|
// create an array with nodes
|
|
var nodes = new vis.DataSet([
|
|
{id: 1, label: 1, color:'#97C2FC'},
|
|
{id: 2, label: 2, color:'#FFFF00'},
|
|
{id: 3, label: 3, color:'#FB7E81'},
|
|
{id: 4, label: 4, color:'#7BE141'},
|
|
{id: 5, label: 5, color:'#6E6EFD'},
|
|
{id: 6, label: 6, color:'#C2FABC'},
|
|
{id: 7, label: 7, color:'#FFA807'},
|
|
{id: 8, label: 8, color:'#6E6EFD'}
|
|
]);
|
|
|
|
// create an array with edges
|
|
var edges = new vis.DataSet([
|
|
{from: 1, to: 8, color:{color:'red'}},
|
|
{from: 1, to: 3, color:'rgb(20,24,200)'},
|
|
{from: 1, to: 2, color:{color:'rgba(30,30,30,0.2)', highlight:'blue'}},
|
|
{from: 2, to: 4, color:{inherit:'to'}},
|
|
{from: 2, to: 5, color:{inherit:'from'}},
|
|
{from: 5, to: 6, color:{inherit:'both'}},
|
|
{from: 6, to: 7, color:{color:'#ff0000', opacity:0.3}},
|
|
{from: 6, to: 8, color:{opacity:0.3}},
|
|
]);
|
|
|
|
// create a network
|
|
var container = document.getElementById('mynetwork');
|
|
var data = {
|
|
nodes: nodes,
|
|
edges: edges
|
|
};
|
|
var options = {};
|
|
var network = new vis.Network(container, data, options);
|
|
</script>
|
|
|
|
<script src="../../googleAnalytics.js"></script>
|
|
</body>
|
|
</html>
|