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.
155 lines
7.7 KiB
155 lines
7.7 KiB
<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 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>-->
|
|
<link
|
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"
|
|
rel="stylesheet"
|
|
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
|
|
crossorigin="anonymous"
|
|
/>
|
|
<script
|
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/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: 750px;
|
|
background-color: #222222;
|
|
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">
|
|
|
|
// initialize global variables.
|
|
var edges;
|
|
var nodes;
|
|
var allNodes;
|
|
var allEdges;
|
|
var nodeColors;
|
|
var originalNodes;
|
|
var network;
|
|
var container;
|
|
var options, data;
|
|
var filter = {
|
|
item : '',
|
|
property : '',
|
|
value : []
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 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([{"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "1", "label": "\u5218\u90a6", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "2", "label": "\u79e6\u59cb\u7687", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "3", "label": "\u9879\u7fbd", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "4", "label": "\u5f20\u826f", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "5", "label": "\u8427\u4f55", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "6", "label": "\u97e9\u4fe1", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "10", "label": "\u5415\u540e", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "7", "label": "\u674e\u65af", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "8", "label": "\u5415\u4e0d\u97e6", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "9", "label": "\u5b34\u653f", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "13", "label": "\u738b\u7fe6", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "14", "label": "\u8499\u606c", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "15", "label": "\u6276\u82cf", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "16", "label": "\u80e1\u4ea5", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "11", "label": "\u9879\u6881", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "12", "label": "\u695a\u6000\u738b", "shape": "dot", "size": 10}, {"font": {"color": "white"}, "group": "\u56e2\u4f53", "id": "17", "label": "\u6c49\u521d\u4e09\u6770", "shape": "dot", "size": 10}]);
|
|
edges = new vis.DataSet([{"from": "1", "title": "\u5386\u53f2\u5f71\u54cd", "to": "2", "width": 1}, {"from": "1", "title": "\u654c\u5bf9", "to": "3", "width": 1}, {"from": "1", "title": "\u541b\u81e3", "to": "4", "width": 1}, {"from": "1", "title": "\u541b\u81e3", "to": "5", "width": 1}, {"from": "1", "title": "\u541b\u81e3", "to": "6", "width": 1}, {"from": "1", "title": "\u592b\u59bb", "to": "10", "width": 1}, {"from": "2", "title": "\u541b\u81e3", "to": "7", "width": 1}, {"from": "2", "title": "\u7591\u4f3c\u7236\u5b50", "to": "8", "width": 1}, {"from": "2", "title": "\u540c\u4e00\u4eba", "to": "9", "width": 1}, {"from": "2", "title": "\u541b\u81e3", "to": "13", "width": 1}, {"from": "2", "title": "\u541b\u81e3", "to": "14", "width": 1}, {"from": "2", "title": "\u7236\u5b50", "to": "15", "width": 1}, {"from": "2", "title": "\u7236\u5b50", "to": "16", "width": 1}, {"from": "2", "title": "\u523a\u6740\u672a\u9042", "to": "4", "width": 1}, {"from": "3", "title": "\u53d4\u4f84", "to": "11", "width": 1}, {"from": "3", "title": "\u541b\u81e3", "to": "12", "width": 1}, {"from": "4", "title": "\u540c\u50da", "to": "6", "width": 1}, {"from": "4", "title": "\u540c\u50da", "to": "5", "width": 1}, {"from": "4", "title": "\u6210\u5458", "to": "17", "width": 1}, {"from": "5", "title": "\u6210\u5458", "to": "17", "width": 1}, {"from": "6", "title": "\u6210\u5458", "to": "17", "width": 1}]);
|
|
|
|
nodeColors = {};
|
|
allNodes = nodes.get({ returnType: "Object" });
|
|
for (nodeId in allNodes) {
|
|
nodeColors[nodeId] = allNodes[nodeId].color;
|
|
}
|
|
allEdges = edges.get({ returnType: "Object" });
|
|
// 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,
|
|
"stabilization": {
|
|
"enabled": true,
|
|
"fit": true,
|
|
"iterations": 1000,
|
|
"onlyDynamicEdges": false,
|
|
"updateInterval": 50
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
network = new vis.Network(container, data, options);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return network;
|
|
|
|
}
|
|
drawGraph();
|
|
</script>
|
|
</body>
|
|
</html> |