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.3 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\u671d\u5f00\u56fd\u7687\u5e1d\uff0c\u51fb\u8d25\u9879\u7fbd\u5efa\u7acb\u6c49\u671d"}, {"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\u7edf\u4e00\u516d\u56fd\u5efa\u7acb\u79e6\u671d"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "5", "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": "6", "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": "7", "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\u52a9\u624b"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "8", "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": "\u8457\u4f5c", "id": "3", "label": "\u300a\u53f2\u8bb0\u300b", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u300a\u53f2\u8bb0\u300b\n\u7c7b\u578b: \u8457\u4f5c\n\u8be6\u7ec6\u4fe1\u606f: \u53f8\u9a6c\u8fc1\u64b0\u5199\u7684\u7eaa\u4f20\u4f53\u901a\u53f2"}, {"font": {"color": "white"}, "group": "\u56fd\u5bb6", "id": "4", "label": "\u79e6\u56fd", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u79e6\u56fd\n\u7c7b\u578b: \u56fd\u5bb6\n\u8be6\u7ec6\u4fe1\u606f: \u6218\u56fd\u4e03\u96c4\u4e4b\u4e00\uff0c\u7edf\u4e00\u4e2d\u56fd\u5efa\u7acb\u79e6\u671d"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "9", "label": "\u674e\u65af", "shape": "dot", "size": 10, "title": "\u540d\u79f0: \u674e\u65af\n\u7c7b\u578b: \u4eba\u7269\n\u8be6\u7ec6\u4fe1\u606f: \u79e6\u59cb\u7687\u7684\u4e1e\u76f8\uff0c\u534f\u52a9\u7edf\u4e00\u516d\u56fd"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "10", "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\u56fd\u4e1e\u76f8\uff0c\u636e\u4f20\u662f\u79e6\u59cb\u7687\u751f\u7236"}, {"font": {"color": "white"}, "group": "\u4eba\u7269", "id": "11", "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\u7684\u672c\u540d"}]);
edges = new vis.DataSet([{"color": "#011627", "from": "1", "title": "\u5386\u53f2\u5f71\u54cd", "to": "2", "width": 1}, {"color": "#011627", "from": "1", "title": "\u5bf9\u624b", "to": "5", "width": 1}, {"color": "#2EC4B6", "from": "1", "title": "\u541b\u81e3", "to": "6", "width": 1}, {"color": "#2EC4B6", "from": "1", "title": "\u541b\u81e3", "to": "7", "width": 1}, {"color": "#2EC4B6", "from": "1", "title": "\u541b\u81e3", "to": "8", "width": 1}, {"color": "#011627", "from": "1", "title": "\u8bb0\u8f7d", "to": "3", "width": 1}, {"color": "#011627", "from": "2", "title": "\u7edf\u6cbb", "to": "4", "width": 1}, {"color": "#011627", "from": "2", "title": "\u5f71\u54cd", "to": "5", "width": 1}, {"color": "#2EC4B6", "from": "2", "title": "\u541b\u81e3", "to": "9", "width": 1}, {"color": "#011627", "from": "2", "title": "\u8eab\u4e16", "to": "10", "width": 1}, {"color": "#011627", "from": "2", "title": "\u540c\u4e00\u4eba", "to": "11", "width": 1}, {"color": "#011627", "from": "2", "title": "\u8bb0\u8f7d", "to": "3", "width": 1}, {"color": "#011627", "from": "2", "title": "\u523a\u6740", "to": "6", "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 = {"nodes": {"font": {"size": 14, "face": "arial"}}, "layout": {"hierarchical": {"enabled": false}}, "physics": {"hierarchicalRepulsion": {"centralGravity": 0.0, "springLength": 200, "springConstant": 0.01, "nodeDistance": 120, "damping": 0.09}, "minVelocity": 0.75, "solver": "hierarchicalRepulsion"}};
network = new vis.Network(container, data, options);
return network;
}
drawGraph();
</script>
</body>
</html>