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.

127 lines
8.1 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, "title": "\u540d\u79f0: \u5218\u90a6\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u6c49\u9ad8\u7956\u5218\u90a6\uff0c\u6c49\u671d\u5f00\u56fd\u7687\u5e1d"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "2", "label": "\u79e6\u59cb\u7687", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u79e6\u59cb\u7687\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u4e2d\u56fd\u7b2c\u4e00\u4f4d\u7687\u5e1d\uff0c\u79e6\u671d\u5efa\u7acb\u8005"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "3", "label": "\u9879\u7fbd", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u9879\u7fbd\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u897f\u695a\u9738\u738b\uff0c\u5218\u90a6\u7684\u4e3b\u8981\u5bf9\u624b"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "4", "label": "\u5f20\u826f", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u5f20\u826f\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u6c49\u521d\u4e09\u6770\u4e4b\u4e00\uff0c\u5218\u90a6\u7684\u91cd\u8981\u8c0b\u58eb"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "5", "label": "\u8427\u4f55", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u8427\u4f55\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u6c49\u521d\u4e09\u6770\u4e4b\u4e00\uff0c\u5218\u90a6\u7684\u91cd\u8981\u5927\u81e3"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "6", "label": "\u97e9\u4fe1", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u97e9\u4fe1\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u6c49\u521d\u4e09\u6770\u4e4b\u4e00\uff0c\u8457\u540d\u519b\u4e8b\u5c06\u9886"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "7", "label": "\u674e\u65af", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u674e\u65af\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u79e6\u671d\u4e1e\u76f8\uff0c\u534f\u52a9\u79e6\u59cb\u7687\u7edf\u4e00\u516d\u56fd"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "8", "label": "\u5415\u4e0d\u97e6", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u5415\u4e0d\u97e6\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u79e6\u671d\u91cd\u8981\u653f\u6cbb\u5bb6\uff0c\u636e\u4f20\u4e3a\u79e6\u59cb\u7687\u751f\u7236"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "9", "label": "\u5b34\u653f", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u5b34\u653f\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u79e6\u59cb\u7687\u672c\u540d"}, {"font": {"color": "white"}, "group": "\u56e2\u4f53", "id": "10", "label": "\u6c49\u521d\u4e09\u6770", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u6c49\u521d\u4e09\u6770\n\u7c7b\u578b: \u56e2\u4f53\n\u8be6\u7ec6\u4fe1\u606f: \u5f20\u826f\u3001\u8427\u4f55\u3001\u97e9\u4fe1\u7ec4\u6210\u7684\u6838\u5fc3\u4eba\u624d\u4f53\u7cfb"}]);
edges = new vis.DataSet([{"color": "#011627", "from": "1", "title": "\u5386\u53f2\u5173\u8054", "to": "2", "width": 1}, {"color": "#011627", "from": "1", "title": "\u654c\u5bf9\u5173\u7cfb", "to": "3", "width": 1}, {"color": "#011627", "from": "1", "title": "\u541b\u81e3\u5173\u7cfb", "to": "4", "width": 1}, {"color": "#011627", "from": "1", "title": "\u541b\u81e3\u5173\u7cfb", "to": "5", "width": 1}, {"color": "#011627", "from": "1", "title": "\u541b\u81e3\u5173\u7cfb", "to": "6", "width": 1}, {"color": "#011627", "from": "2", "title": "\u541b\u81e3\u5173\u7cfb", "to": "7", "width": 1}, {"color": "#011627", "from": "2", "title": "\u7236\u5b50\u5173\u7cfb(\u4f20\u8bf4)", "to": "8", "width": 1}, {"color": "#011627", "from": "2", "title": "\u540c\u4e00\u4eba\u7269", "to": "9", "width": 1}, {"color": "#011627", "from": "2", "title": "\u654c\u5bf9\u5173\u7cfb", "to": "4", "width": 1}, {"color": "#011627", "from": "4", "title": "\u540c\u50da\u5173\u7cfb", "to": "6", "width": 1}, {"color": "#011627", "from": "4", "title": "\u540c\u50da\u5173\u7cfb", "to": "5", "width": 1}, {"color": "#011627", "from": "4", "title": "\u6210\u5458\u5173\u7cfb", "to": "10", "width": 1}, {"color": "#011627", "from": "5", "title": "\u6210\u5458\u5173\u7cfb", "to": "10", "width": 1}, {"color": "#011627", "from": "6", "title": "\u6210\u5458\u5173\u7cfb", "to": "10", "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 = {"title": {"text": "\u77e5\u8bc6\u56fe\u8c31", "style": {"fontSize": 20, "color": "#333"}}, "nodes": {"font": {"size": 14, "face": "arial"}}, "layout": {"hierarchical": {"enabled": false}}};
network = new vis.Network(container, data, options);
return network;
}
drawGraph();
</script>
</body>
</html>