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.
 
 
 

94 lines
3.0 KiB

<!doctype html>
<html>
<head>
<title>Vis Popup Example</title>
<style type="text/css">
body {
font: 10pt sans;
}
#mynetwork {
width: 600px;
height: 600px;
border: 1px solid lightgray;
}
</style>
<script src="../dist/vis.js" type="text/javascript" ></script>
<link href="../dist/vis.css" rel="stylesheet" type="text/css"/>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">
var network = null;
var network2 = null;
function draw() {
var nodes = [];
var edges = [];
nodes.push({ id: 1, label: 'Node1' });
nodes.push({ id: 2, label: 'Node2' });
edges.push({ from: 2, to: 1 });
var data = {
nodes: nodes,
edges: edges
};
// create a network
var container = document.getElementById('mynetwork');
var options = {
layout: {
hierarchical: {
direction: "UD"
}
}
};
network = new vis.Network(container, data, options);
$('#divTreemapPopUp').modal('show');
//
// var nodes2 = [];
// var edges2 = [];
// nodes2.push({ id: 1, label: 'Node1' });
// nodes2.push({ id: 2, label: 'Node2' });
// edges2.push({ from: 2, to: 1 });
//
// var data2 = {
// nodes: nodes2,
// edges: edges2
// };
//
// // create a network
// var container2 = document.getElementById('mynetwork2');
// var options2 = {
// layout: {
// hierarchical: {
// direction: "UD"
// }
// }
// };
// network2 = new vis.Network(container2, data2, options2);
// setTimeout(function() {console.log('redraw');network.redraw()},1000)
}
</script>
</head>
<body onload="draw();">
<h2>Popup Example</h2>
<div style='display: none;' class='modal fade' id='divTreemapPopUp' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
<div class='modal-dialog'><div class='modal-content'><div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>
<h4 class='modal-title'>TreeMap</h4></div>
<div class='modal-body'>
<div id='mynetwork'></div></div>
<div class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>Close</button></div></div></div></div>
<div id='mynetwork2'></div>
</body>
</html>