Skip to content

Commit

Permalink
Merge pull request WestHealth#212 from WestHealth/write_html_rewrite
Browse files Browse the repository at this point in the history
Lib directory rewrite handling
  • Loading branch information
summerswallow-whi authored Feb 10, 2023
2 parents 8ce37e5 + 58a3b67 commit ccb7ce7
Show file tree
Hide file tree
Showing 20 changed files with 5,379 additions and 4,280 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ pyvis/make.bat

# vscode specific
.vscode/
venv
venv

# intellij specific
.idea/
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

20 changes: 0 additions & 20 deletions .idea/pyvis.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

151 changes: 96 additions & 55 deletions notebooks/dot.html
Original file line number Diff line number Diff line change
@@ -1,84 +1,125 @@
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vis-network@latest/styles/vis-network.css" type="text/css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vis-network@latest/dist/vis-network.min.js"> </script>
<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/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/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: #ffffff;
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>

<style type="text/css">



#mynetwork {
width: 500px;
height: 500px;
background-color: #ffffff;
border: 1px solid lightgray;
position: relative;
float: left;
}
<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 : []
};




</style>


</head>
// This method is responsible for drawing the graph, returns the drawn network
function drawGraph() {
var container = document.getElementById('mynetwork');

<body>
<div id = "mynetwork"></div>


var DOTstring = "digraph { a [label=12, entity_id=12, entity_class=\"truck\"]; b [label=7, entity_id=7,entity_class=\"bike\"]; c [label=3, entity_id=3, entity_class=\"car\"]; a -> b[label=\"solid edge\"]; a -> b [label=\"dashed edge\", style=dashed]; a -> c [label=\"dashed edge\", style=dashed]; a -> c [label=\"dotted edge\", style=dotted]; }";
var parsedData = vis.network.convertDot(DOTstring);

<script type="text/javascript">
data = {
nodes: parsedData.nodes,
edges: parsedData.edges
}

// initialize global variables.
var edges;
var nodes;
var network;
var container;
var options, data;
var options = parsedData.options;
options.nodes = {
shape: "dot"
}


// This method is responsible for drawing the graph, returns the drawn network
function drawGraph() {
var container = document.getElementById('mynetwork');




var DOTstring = "digraph { a [label=12, entity_id=12, entity_class=\"truck\"]; b [label=7, entity_id=7,entity_class=\"bike\"]; c [label=3, entity_id=3, entity_class=\"car\"]; a -> b[label=\"solid edge\"]; a -> b [label=\"dashed edge\", style=dashed]; a -> c [label=\"dashed edge\", style=dashed]; a -> c [label=\"dotted edge\", style=dotted]; }";
data = vis.network.dotparser.DOTToGraph(DOTstring);

var options = data.options;
options = Object.assign(options, {
nodes: {
shape: "dot"
},
});

options = Object.assign(options, {"physics": {"enabled": true, "barnesHut": {"theta": 0.5, "gravitationalConstant": -2000, "centralGravity": 0.3, "springLength": 200, "springConstant": 0.04, "damping": 0.09, "avoidOverlap": 0}, "maxVelocity": 50, "minVelocity": 0.1, "solver": "barnesHut", "stabilization": {"enabled": true, "iterations": 1000, "updateInterval": 100, "onlyDynamicEdges": false, "fit": true}}})






network = new vis.Network(container, data, options);

network = new vis.Network(container, data, options);








return network;

}

drawGraph();
return network;

</script>
</body>
}
drawGraph();
</script>
</body>
</html>
Loading

0 comments on commit ccb7ce7

Please sign in to comment.