Spaces:
Build error
Build error
<html> | |
<head> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" /> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script> | |
<center> | |
<h1></h1> | |
</center> | |
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" /> | |
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>--> | |
<style type="text/css"> | |
#mynetwork { | |
width: 700px; | |
height: 700px; | |
background-color: #ffffff; | |
border: 1px solid lightgray; | |
position: relative; | |
float: left; | |
} | |
</style> | |
</head> | |
<body> | |
<div id = "mynetwork"></div> | |
<script type="text/javascript"> | |
// initialize global variables. | |
var edges; | |
var nodes; | |
var network; | |
var container; | |
var options, data; | |
// This method is responsible for drawing the graph, returns the drawn network | |
function drawGraph() { | |
var container = document.getElementById('mynetwork'); | |
// parsing and collecting nodes and edges from the python | |
nodes = new vis.DataSet([{"id": "software testing", "label": "software testing", "shape": "circle"}, {"id": "software under test", "label": "software under test", "shape": "circle"}]); | |
edges = new vis.DataSet([{"arrows": "to", "from": "software under test", "label": "subclass of", "title": "subclass of", "to": "software testing"}]); | |
// adding nodes and edges to the graph | |
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, | |
"repulsion": { | |
"centralGravity": 0.2, | |
"damping": 0.09, | |
"nodeDistance": 200, | |
"springConstant": 0.05, | |
"springLength": 200 | |
}, | |
"solver": "repulsion", | |
"stabilization": { | |
"enabled": true, | |
"fit": true, | |
"iterations": 1000, | |
"onlyDynamicEdges": false, | |
"updateInterval": 50 | |
} | |
} | |
}; | |
network = new vis.Network(container, data, options); | |
return network; | |
} | |
drawGraph(); | |
</script> | |
</body> | |
</html> |