|
<html> |
|
<head> |
|
<meta charset="utf-8"> |
|
|
|
<script src="lib/bindings/utils.js"></script> |
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/dist/vis-network.min.css" integrity="sha512-WgxfT5LWjfszlPHXRmBWHkV2eceiWTOBvrKCNbdgDYTHrT2AeLCGbF4sZlZw3UMN3WtL0tGUoIAKsu8mllg/XA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js" integrity="sha512-LnvoEWDFrqGHlHmDD2101OrLcbsfkrzoSpvtSQtxK3RMnRV0eOkhhBN2dXHKRrUU8p2DGRTk35n4O8nWSVe1mQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> |
|
|
|
|
|
<center> |
|
<h1></h1> |
|
</center> |
|
|
|
|
|
|
|
<link |
|
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" |
|
rel="stylesheet" |
|
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" |
|
crossorigin="anonymous" |
|
/> |
|
<script |
|
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" |
|
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" |
|
crossorigin="anonymous" |
|
></script> |
|
|
|
|
|
<center> |
|
<h1></h1> |
|
</center> |
|
<style type="text/css"> |
|
|
|
#mynetwork { |
|
width: 100%; |
|
height: 600px; |
|
background-color: #ffffff; |
|
border: 1px solid lightgray; |
|
position: relative; |
|
float: left; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
</head> |
|
|
|
|
|
<body> |
|
<div class="card" style="width: 100%"> |
|
|
|
|
|
<div id="mynetwork" class="card-body"></div> |
|
</div> |
|
|
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
|
var edges; |
|
var nodes; |
|
var allNodes; |
|
var allEdges; |
|
var nodeColors; |
|
var originalNodes; |
|
var network; |
|
var container; |
|
var options, data; |
|
var filter = { |
|
item : '', |
|
property : '', |
|
value : [] |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
function drawGraph() { |
|
var container = document.getElementById('mynetwork'); |
|
|
|
|
|
|
|
|
|
nodes = new vis.DataSet([{"centrality": 0.071, "color": "#97c2fc", "id": "Acciaiuoli", "label": "Acciaiuoli", "shape": "dot", "size": 7.1}, {"centrality": 0.429, "color": "#97c2fc", "id": "Medici", "label": "Medici", "shape": "dot", "size": 42.9}, {"centrality": 0.286, "color": "#97c2fc", "id": "Strozzi", "label": "Strozzi", "shape": "dot", "size": 28.599999999999998}, {"centrality": 0.143, "color": "#97c2fc", "id": "Salviati", "label": "Salviati", "shape": "dot", "size": 14.299999999999999}, {"centrality": 0.214, "color": "#97c2fc", "id": "Castellani", "label": "Castellani", "shape": "dot", "size": 21.4}, {"centrality": 0.214, "color": "#97c2fc", "id": "Peruzzi", "label": "Peruzzi", "shape": "dot", "size": 21.4}, {"centrality": 0.143, "color": "#97c2fc", "id": "Barbadori", "label": "Barbadori", "shape": "dot", "size": 14.299999999999999}, {"centrality": 0.214, "color": "#97c2fc", "id": "Ridolfi", "label": "Ridolfi", "shape": "dot", "size": 21.4}, {"centrality": 0.214, "color": "#97c2fc", "id": "Tornabuoni", "label": "Tornabuoni", "shape": "dot", "size": 21.4}, {"centrality": 0.214, "color": "#97c2fc", "id": "Albizzi", "label": "Albizzi", "shape": "dot", "size": 21.4}, {"centrality": 0.071, "color": "#97c2fc", "id": "Pazzi", "label": "Pazzi", "shape": "dot", "size": 7.1}, {"centrality": 0.214, "color": "#97c2fc", "id": "Bischeri", "label": "Bischeri", "shape": "dot", "size": 21.4}, {"centrality": 0.286, "color": "#97c2fc", "id": "Guadagni", "label": "Guadagni", "shape": "dot", "size": 28.599999999999998}, {"centrality": 0.071, "color": "#97c2fc", "id": "Ginori", "label": "Ginori", "shape": "dot", "size": 7.1}, {"centrality": 0.071, "color": "#97c2fc", "id": "Lamberteschi", "label": "Lamberteschi", "shape": "dot", "size": 7.1}]); |
|
edges = new vis.DataSet([{"from": "Acciaiuoli", "to": "Medici", "width": 1}, {"from": "Acciaiuoli", "to": "Strozzi", "width": 1}, {"from": "Acciaiuoli", "to": "Salviati", "width": 1}, {"from": "Medici", "to": "Castellani", "width": 1}, {"from": "Medici", "to": "Peruzzi", "width": 1}, {"from": "Medici", "to": "Strozzi", "width": 1}, {"from": "Medici", "to": "Barbadori", "width": 1}, {"from": "Medici", "to": "Ridolfi", "width": 1}, {"from": "Medici", "to": "Tornabuoni", "width": 1}, {"from": "Medici", "to": "Albizzi", "width": 1}, {"from": "Medici", "to": "Salviati", "width": 1}, {"from": "Medici", "to": "Pazzi", "width": 1}, {"from": "Castellani", "to": "Peruzzi", "width": 1}, {"from": "Peruzzi", "to": "Strozzi", "width": 1}, {"from": "Strozzi", "to": "Barbadori", "width": 1}, {"from": "Strozzi", "to": "Ridolfi", "width": 1}, {"from": "Strozzi", "to": "Tornabuoni", "width": 1}, {"from": "Strozzi", "to": "Albizzi", "width": 1}, {"from": "Strozzi", "to": "Salviati", "width": 1}, {"from": "Barbadori", "to": "Ridolfi", "width": 1}, {"from": "Barbadori", "to": "Tornabuoni", "width": 1}, {"from": "Barbadori", "to": "Albizzi", "width": 1}, {"from": "Ridolfi", "to": "Tornabuoni", "width": 1}, {"from": "Ridolfi", "to": "Albizzi", "width": 1}, {"from": "Tornabuoni", "to": "Albizzi", "width": 1}, {"from": "Tornabuoni", "to": "Salviati", "width": 1}, {"from": "Albizzi", "to": "Salviati", "width": 1}, {"from": "Bischeri", "to": "Guadagni", "width": 1}, {"from": "Bischeri", "to": "Ginori", "width": 1}, {"from": "Bischeri", "to": "Lamberteschi", "width": 1}, {"from": "Guadagni", "to": "Ginori", "width": 1}, {"from": "Guadagni", "to": "Lamberteschi", "width": 1}, {"from": "Ginori", "to": "Lamberteschi", "width": 1}]); |
|
|
|
nodeColors = {}; |
|
allNodes = nodes.get({ returnType: "Object" }); |
|
for (nodeId in allNodes) { |
|
nodeColors[nodeId] = allNodes[nodeId].color; |
|
} |
|
allEdges = edges.get({ returnType: "Object" }); |
|
|
|
data = {nodes: nodes, edges: edges}; |
|
|
|
var options = { |
|
"configure": { |
|
"enabled": false |
|
}, |
|
"edges": { |
|
"color": { |
|
"inherit": true |
|
}, |
|
"smooth": { |
|
"enabled": true, |
|
"type": "dynamic" |
|
} |
|
}, |
|
"interaction": { |
|
"dragNodes": true, |
|
"hideEdgesOnDrag": false, |
|
"hideNodesOnDrag": false |
|
}, |
|
"physics": { |
|
"enabled": true, |
|
"stabilization": { |
|
"enabled": true, |
|
"fit": true, |
|
"iterations": 1000, |
|
"onlyDynamicEdges": false, |
|
"updateInterval": 50 |
|
} |
|
} |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
network = new vis.Network(container, data, options); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return network; |
|
|
|
} |
|
drawGraph(); |
|
</script> |
|
</body> |
|
</html> |