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.
 
 
 

257 lines
14 KiB

<!DOCTYPE html>
<html lang="en">
<head><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Network Examples</title>
<link rel="icon" HREF="favicon.ico">
<!-- Bootstrap -->
<link href="./css/bootstrap.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link href="./css/prettify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/prettify/prettify.js"></script>
<script src="./dist/vis.js"></script>
<link href="./dist/vis.css" rel="stylesheet" type="text/css" />
<link href="./css/examples.css" rel="stylesheet" type="text/css" />
<style>
#networkContainer {
margin:0px;
padding:0px;
position:relative;
height: 3083px;
width: 100%;
z-index:0;
}
#contentContainer {
margin:0px;
padding:0px;
position:relative;
margin-top:-3083px;
width: 100%;
z-index:2;
}
</style>
<script>
var network;
function loadVis() {
var exampleContainer = document.getElementById('contentContainer');
var links = exampleContainer.getElementsByTagName('a');
var nodesArray = [];
var edgesArray = [];
var idCounter = 0;
var firstLink = undefined;
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.className === 'exampleLink') {
var linkRect = link.getBoundingClientRect();
var linkWidth = linkRect.right - linkRect.left;
if (firstLink === undefined) {
firstLink = link;
}
nodesArray.push({id:idCounter,
x:link.offsetLeft + linkWidth,
y:link.offsetTop,
color:{
background:'rgba(0,0,0,0.0)',
border:'rgba(70,158,255,0)'
},
shape:'dot',
size:10,
fixed:true
});
nodesArray.push({id:idCounter + "image",
// label:link.innerHTML,
x:link.offsetLeft + 400 + 100 + (idCounter % 3) * 150,
y:link.offsetTop,
color:{
border:'rgba(70,158,255,1)'
},
shadow:{
size:2,
x:0,
y:0
},
shape:'image',
image:'./images/exampleScreenshots/network/'+(idCounter+1)+'.png',
size:60
});
edgesArray.push({from: idCounter, to: idCounter+"image"});
idCounter += 1;
}
}
var nodes = new vis.DataSet(nodesArray);
var edges = new vis.DataSet(edgesArray);
var networkContainer = document.getElementById('networkContainer');
var data = {
nodes: nodes,
edges: edges
};
var options = {
edges:{
color:{inherit:'both'},
smooth:{enabled:false,type:'continuous'}
},
physics: false,
interaction:{
zoomView:false,
dragView: false
}
};
network = new vis.Network(networkContainer, data, options);
// get the offset
var firstLinkPos = {x:firstLink.offsetLeft, y:firstLink.offsetTop};
var firstLinkRect = firstLink.getBoundingClientRect();
var firstLinkWidth = firstLinkRect.right - firstLinkRect.left;
var firstLinkHeight = firstLinkRect.bottom - firstLinkRect.top;
var rect = networkContainer.getBoundingClientRect();
var width = rect.right - rect.left;
var height = rect.bottom - rect.top;
var ydiff = exampleContainer.offsetTop - networkContainer.offsetTop;
network.moveTo({
scale: 1,
position: network.getPositions([0])[0],
offset: {
x: -0.5 * width + firstLinkPos.x + firstLinkWidth,
y: -0.5 * height + firstLinkPos.y + ydiff + 0.5 * firstLinkHeight
},
animation: false
});
}
</script>
</head>
<body onload="loadVis();">
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="./index.html#modules">Modules</a></li>
<li><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="./images/external-link-icons/external-link-icon-white.png"></a></li>
<li><a href="./blog.html">Blog</a></li>
<li><a href="./index.html#download_install">Download</a></li>
<li><a href="./showcase/index.html">Showcase</a></li>
<li><a href="./index.html#contribute">Contribute</a></li>
<li><a href="./featureRequests.html">Feature requests</a></li>
<li><a href="./index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>
<div class="contentWrapper">
<div id="networkContainer"></div>
<div id="contentContainer">
<h1>Network Examples</h1>
This page contains examples which show how to use Network. For the documentation, please click the button below: <br><br>
<a class="btn btn-primary" href="./docs/network" role="button">View docs »</a>
<h3>basic usage</h3>
<a class='exampleLink' href="examples/network/basic_usage.html">basic usage</a><br />
<h3>node styles</h3>
<a class='exampleLink' href="examples/network/nodeStyles/colors.html">colors</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/groups.html">groups</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/customGroups.html">custom groups</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/HTML_in_Nodes.html">HTML in nodes</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/icons.html">icons (Fontawesome and Ionicons)</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/images.html">images</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/circular_images.html">circular images</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/shadows.html">node shadows</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/shapes.html">node shapes</a><br />
<h3>edge styles</h3>
<a class='exampleLink' href="examples/network/edgeStyles/arrows.html">arrows (also combined with dashes)</a><br />
<a class='exampleLink' href="examples/network/edgeStyles/colors.html">different colors</a><br />
<a class='exampleLink' href="examples/network/edgeStyles/dashes.html">dashes</a><br />
<a class='exampleLink' href="examples/network/edgeStyles/smooth.html">smooth curves</a><br />
<a class='exampleLink' href="examples/network/edgeStyles/smoothWorldCup.html">smooth curves in action</a><br />
<h3>labels</h3>
<a class='exampleLink' href="examples/network/labels/label_alignment.html">label alignment (for edges only)</a><br />
<a class='exampleLink' href="examples/network/labels/label_background.html">label background</a><br />
<a class='exampleLink' href="examples/network/labels/label_color_and_size.html">colors and sizes</a><br />
<a class='exampleLink' href="examples/network/labels/label_stroke.html">label stroke</a><br />
<a class='exampleLink' href="examples/network/labels/multiline_text.html">multiline text</a><br />
<h3>layout</h3>
<a class='exampleLink' href="examples/network/layout/hierarchical_layout.html">hierarchical layout</a><br />
<a class='exampleLink' href="examples/network/layout/hierarchical_layout_methods.html">hierarchical layout - different methods</a><br />
<a class='exampleLink' href="examples/network/layout/hierarchical_layout_userdefined.html">hierarchical layout - user defined</a><br />
<a class='exampleLink' href="examples/network/layout/randomSeed.html">set the random seed so every network will be the same</a><br />
<h3>events</h3>
<a class='exampleLink' href="examples/network/events/interactionEvents.html">interaction events, click, rightclick, drag etc.</a><br />
<a class='exampleLink' href="examples/network/events/physicsEvents.html">physics events, stabilization etc.</a><br />
<a class='exampleLink' href="examples/network/events/renderEvents.html">rendering events, use to draw custom items on the canvas.</a><br />
<h3>dynamic data</h3>
<a class='exampleLink' href="examples/network/data/datasets.html">dataset for dynamic data</a><br />
<a class='exampleLink' href="examples/network/data/dynamic_data.html">dynamic data, playground</a><br />
<a class='exampleLink' href="examples/network/data/importing_from_gephi.html">importing data from gephi</a><br />
<a class='exampleLink' href="examples/network/data/scaling_custom.html">scaling the nodes with the value.</a><br />
<a class='exampleLink' href="examples/network/data/scaling_nodes_edges.html">scaling the nodes and edges with the value.</a><br />
<a class='exampleLink' href="examples/network/data/scaling_nodes_edges_labels.html">scaling the nodes, edges and labels with the value.</a><br />
<h3>physics</h3>
<a class='exampleLink' href="examples/network/physics/physicsConfiguration.html">physics configuration</a><br />
<h3>example applications</h3>
<a class='exampleLink' href="examples/network/exampleApplications/les_miserables.html">les miserables cast</a><br />
<a class='exampleLink' href="examples/network/exampleApplications/loadingBar.html">loading bar during stabilization</a><br />
<a class='exampleLink' href="examples/network/exampleApplications/neighbourhood_highlight.html">neighbourhood heighlight</a><br />
<a class='exampleLink' href="examples/network/exampleApplications/nodeLegend.html">using nodes as a legend</a><br />
<a class='exampleLink' href="examples/network/exampleApplications/worldCupPerformance.html">performance test with the worldcup data</a><br />
<h3>other</h3>
<a class='exampleLink' href="examples/network/other/animationShowcase.html">animation showcase</a><br />
<a class='exampleLink' href="examples/network/other/clustering.html">clustering possibilities</a><br />
<a class='exampleLink' href="examples/network/other/clusteringByZoom.html">clustering by zoom</a><br />
<a class='exampleLink' href="examples/network/other/configuration.html">dynamic configuration</a><br />
<a class='exampleLink' href="examples/network/other/manipulation.html">manipulation interface and localization</a><br />
<a class='exampleLink' href="examples/network/other/navigation.html">navigation buttons and keyboard shortcuts</a><br />
<a class='exampleLink' href="examples/network/other/performance.html">performance test with scale free network</a><br />
</div>
</div>
<br />
<br />
<br />
<br />
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>