mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-25 18:02:35 +02:00
180 lines
7.9 KiB
HTML
180 lines
7.9 KiB
HTML
<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: 600px;
|
|
background-color: white;
|
|
border: 1px solid lightgray;
|
|
position: relative;
|
|
float: left;
|
|
}
|
|
|
|
|
|
|
|
|
|
#config {
|
|
float: left;
|
|
width: 400px;
|
|
height: 600px;
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
</head>
|
|
|
|
|
|
<body>
|
|
<div class="card" style="width: 100%">
|
|
|
|
|
|
<div id="mynetwork" class="card-body"></div>
|
|
</div>
|
|
|
|
|
|
|
|
<div id="config"></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([{"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 2, "label": "Volkswagen AG", "shape": "dot", "size": 2.6656522175918687, "title": "Volkswagen AG\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 1, "label": "Porsche Automobil Holding", "shape": "dot", "size": 14.003687099537842, "title": "Porsche Automobil Holding\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 3, "label": "Volkswagen", "shape": "dot", "size": 2.6656522175918687, "title": "Volkswagen\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 4, "label": "Audi", "shape": "dot", "size": 9.377492579893957, "title": "Audi\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 5, "label": "Seat", "shape": "dot", "size": 2.6656522175918687, "title": "Seat\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 6, "label": "Skoda Auto", "shape": "dot", "size": 2.6656522175918687, "title": "Skoda Auto\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 7, "label": "Porsche AG", "shape": "dot", "size": 2.6656522175918687, "title": "Porsche AG\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 8, "label": "Lamborghini", "shape": "dot", "size": 2.6745569912566833, "title": "Lamborghini\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilhersteller", "color": " #729b79ff", "font": {"color": "black"}, "id": 9, "label": "Bentley", "shape": "dot", "size": 2.6745569912566833, "title": "Bentley\nAutomobilhersteller", "type": "Company"}, {"branche": "Automobilzulieferer", "color": "#475b63ff", "font": {"color": "black"}, "id": 10, "label": "Forvia", "shape": "dot", "size": 5.094490318776964, "title": "Forvia\nAutomobilzulieferer", "type": "Company"}, {"branche": "Automobilzulieferer", "color": "#475b63ff", "font": {"color": "black"}, "id": 11, "label": "Hella", "shape": "dot", "size": 2.846954931318525, "title": "Hella\nAutomobilzulieferer", "type": "Company"}]);
|
|
edges = new vis.DataSet([{"from": 2, "label": "part_of", "to": 1, "width": 1}, {"from": 1, "label": "part_of", "to": 3, "width": 1}, {"from": 1, "label": "part_of", "to": 4, "width": 1}, {"from": 1, "label": "part_of", "to": 5, "width": 1}, {"from": 1, "label": "part_of", "to": 6, "width": 1}, {"from": 1, "label": "part_of", "to": 7, "width": 1}, {"from": 4, "label": "part_of", "to": 8, "width": 1}, {"from": 4, "label": "part_of", "to": 9, "width": 1}, {"from": 4, "label": "supplierer", "to": 10, "width": 1}, {"from": 11, "label": "part_of", "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 = {
|
|
"configure": {
|
|
"enabled": true,
|
|
"filter": [
|
|
"physics"
|
|
]
|
|
},
|
|
"edges": {
|
|
"color": {
|
|
"inherit": false
|
|
},
|
|
"smooth": {
|
|
"enabled": true,
|
|
"type": "dynamic"
|
|
}
|
|
},
|
|
"interaction": {
|
|
"dragNodes": true,
|
|
"hideEdgesOnDrag": false,
|
|
"hideNodesOnDrag": false
|
|
},
|
|
"physics": {
|
|
"enabled": true,
|
|
"repulsion": {
|
|
"centralGravity": 0.2,
|
|
"damping": 0.09,
|
|
"nodeDistance": 150,
|
|
"springConstant": 0.05,
|
|
"springLength": 50
|
|
},
|
|
"solver": "repulsion",
|
|
"stabilization": {
|
|
"enabled": true,
|
|
"fit": true,
|
|
"iterations": 1000,
|
|
"onlyDynamicEdges": false,
|
|
"updateInterval": 50
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// if this network requires displaying the configure window,
|
|
// put it in its div
|
|
options.configure["container"] = document.getElementById("config");
|
|
|
|
|
|
network = new vis.Network(container, data, options);
|
|
|
|
|
|
network.on("click", neighbourhoodHighlight);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return network;
|
|
|
|
}
|
|
drawGraph();
|
|
</script>
|
|
</body>
|
|
</html> |