-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae6c62a
commit 0a3d701
Showing
13 changed files
with
5,838 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
|
||
<iframe | ||
id="dieeQbbbtTbpv" | ||
width="820" | ||
height="620" | ||
frameborder="0" | ||
srcdoc=" | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Network</title> | ||
<script | ||
type="text/javascript" | ||
src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js" | ||
></script> | ||
<style type="text/css"> | ||
#mynetwork { | ||
width: 800px; | ||
height: 600px; | ||
border: 1px solid lightgray; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="mynetwork"></div> | ||
<script type="text/javascript"> | ||
var nodes = new vis.DataSet([{ id: 0, label: `init`, group: "states" }, | ||
{ id: 1, label: `rolled1`, group: "states" }, | ||
{ id: 2, label: `rolled2`, group: "states" }, | ||
{ id: 3, label: `rolled3`, group: "states" }, | ||
{ id: 4, label: `rolled4`, group: "states" }, | ||
{ id: 5, label: `rolled5`, group: "states" }, | ||
{ id: 6, label: `rolled6`, group: "states" }, | ||
]); | ||
var edges = new vis.DataSet([{ from: 0, to: 1, label: "1/6" }, | ||
{ from: 0, to: 2, label: "1/6" }, | ||
{ from: 0, to: 3, label: "1/6" }, | ||
{ from: 0, to: 4, label: "1/6" }, | ||
{ from: 0, to: 5, label: "1/6" }, | ||
{ from: 0, to: 6, label: "1/6" }, | ||
{ from: 1, to: 1, label: "1" }, | ||
{ from: 2, to: 2, label: "1" }, | ||
{ from: 3, to: 3, label: "1" }, | ||
{ from: 4, to: 4, label: "1" }, | ||
{ from: 5, to: 5, label: "1" }, | ||
{ from: 6, to: 6, label: "1" }, | ||
]); | ||
var options = { | ||
"__fake_macros": { | ||
"__group_macro": { | ||
"borderWidth": 1, | ||
"color": { | ||
"background": "white", | ||
"border": "black", | ||
"highlight": { | ||
"background": "white", | ||
"border": "red" | ||
} | ||
}, | ||
"shape": "ellipse", | ||
"mass": 1, | ||
"font": { | ||
"color": "black", | ||
"size": 14 | ||
} | ||
} | ||
}, | ||
"groups": { | ||
"states": { | ||
"borderWidth": 1, | ||
"color": { | ||
"background": "white", | ||
"border": "black", | ||
"highlight": { | ||
"background": "white", | ||
"border": "red" | ||
} | ||
}, | ||
"shape": "ellipse", | ||
"mass": 1, | ||
"font": { | ||
"color": "black", | ||
"size": 14 | ||
} | ||
}, | ||
"actions": { | ||
"borderWidth": 1, | ||
"color": { | ||
"background": "lightblue", | ||
"border": "black", | ||
"highlight": { | ||
"background": "white", | ||
"border": "red" | ||
} | ||
}, | ||
"shape": "box", | ||
"mass": 1, | ||
"font": { | ||
"color": "black", | ||
"size": 14 | ||
} | ||
}, | ||
"scheduled_actions": { | ||
"borderWidth": 1, | ||
"color": { | ||
"background": "pink", | ||
"border": "black", | ||
"highlight": { | ||
"background": "white", | ||
"border": "red" | ||
} | ||
}, | ||
"shape": "box", | ||
"mass": 1, | ||
"font": { | ||
"color": "black", | ||
"size": 14 | ||
}, | ||
"schedColor": false | ||
} | ||
}, | ||
"reload_button": false, | ||
"edges": { | ||
"arrows": "to", | ||
"font": { | ||
"color": "black", | ||
"size": 14 | ||
}, | ||
"color": { | ||
"color": "black" | ||
} | ||
}, | ||
"numbers": { | ||
"fractions": true, | ||
"digits": 5 | ||
}, | ||
"results_and_rewards": { | ||
"show_results": true, | ||
"resultSymbol": "\u2606", | ||
"show_rewards": true | ||
}, | ||
"layout": { | ||
"randomSeed": 5 | ||
}, | ||
"misc": { | ||
"enable_physics": true, | ||
"width": 800, | ||
"height": 600, | ||
"explore": false | ||
}, | ||
"saving": { | ||
"relative_path": true, | ||
"filename": "layouts/NAME.json", | ||
"save_button": false, | ||
"load_button": false | ||
}, | ||
"positions": {}, | ||
"width": 800, | ||
"height": 600, | ||
"physics": true | ||
}; | ||
//js | ||
var container = document.getElementById("mynetwork"); | ||
var data = { | ||
nodes: nodes, | ||
edges: edges, | ||
}; | ||
var network = new vis.Network(container, data, options); | ||
function makeAllNodesInvisible() { | ||
ids = nodes.getIds(); | ||
for (let i = 0; i < ids.length; i++) { | ||
var nodeId = ids[i]; | ||
var node = nodes.get(nodeId); | ||
node["hidden"] = true; | ||
nodes.update(node); | ||
} | ||
}; | ||
function makeNeighborsVisible(myNode) { | ||
var ids = network.getConnectedNodes(myNode, 'to'); | ||
for (let i = 0; i < ids.length; i++) { | ||
var nodeId = ids[i]; | ||
var node = nodes.get(nodeId); | ||
node["hidden"] = false; | ||
nodes.update(node); | ||
} | ||
}; | ||
function makeNodeVisible(nodeId) { | ||
var node = nodes.get(nodeId); | ||
node["hidden"] = false; | ||
nodes.update(node); | ||
}; | ||
network.on( 'click', function(properties) { | ||
var nodeId = network.getNodeAt({x:properties.event.srcEvent.offsetX, y:properties.event.srcEvent.offsetY}); | ||
makeNeighborsVisible(nodeId); | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
" | ||
border:none !important; | ||
allowfullscreen webkitallowfullscreen mozallowfullscreen | ||
></iframe> |
Oops, something went wrong.