Last active
December 11, 2015 01:09
-
-
Save billroy/4521326 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<html> | |
<body> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script src="springy.js"></script> | |
<script src="springyui.js"></script> | |
<textarea id='network_text' | |
rows=10 cols=100> | |
Paste Here | |
</textarea> | |
<center><input | |
type='submit' value='go' | |
onclick='generateSomething($("#network_text").val());' | |
/> | |
</center> | |
<script type="text/javascript"> | |
function print(text) { | |
$('#output').append(text + '<br/>'); | |
} | |
function generateSomething(text) { | |
print("Something"); | |
print(text); | |
var graph = new Graph(); | |
print("AAA"); | |
var dennis = graph.newNode({label: 'Dennis'}); | |
print("AAB"); | |
var michael = graph.newNode({label: 'Michael'}); | |
var jessica = graph.newNode({label: 'Jessica'}); | |
var timothy = graph.newNode({label: 'Timothy'}); | |
var barbara = graph.newNode({label: 'Barbara'}); | |
var franklin = graph.newNode({label: 'Franklin'}); | |
var monty = graph.newNode({label: 'Monty'}); | |
var james = graph.newNode({label: 'James'}); | |
var bianca = graph.newNode({label: 'Bianca'}); | |
graph.newEdge(dennis, michael, {color: '#00A0B0'}); | |
graph.newEdge(michael, dennis, {color: '#6A4A3C'}); | |
graph.newEdge(michael, jessica, {color: '#CC333F'}); | |
graph.newEdge(jessica, barbara, {color: '#EB6841'}); | |
graph.newEdge(michael, timothy, {color: '#EDC951'}); | |
graph.newEdge(franklin, monty, {color: '#7DBE3C'}); | |
graph.newEdge(dennis, monty, {color: '#000000'}); | |
graph.newEdge(monty, james, {color: '#00A0B0'}); | |
graph.newEdge(barbara, timothy, {color: '#6A4A3C'}); | |
graph.newEdge(dennis, bianca, {color: '#CC333F'}); | |
graph.newEdge(bianca, monty, {color: '#EB6841'}); | |
print("AAD"); | |
var springy = $('#springydemo').springy({ | |
graph: graph, | |
nodeSelected: function(node){ | |
console.log('Node selected: ' + JSON.stringify(node.data)); | |
} | |
}); | |
} | |
</script> | |
<div id='output'> | |
Put your network in a .csv file.<br> | |
Open that .csv file with a text editor.<br> | |
Copy the text content. Paste it in the box.<br> | |
</div> | |
<canvas id="springydemo" width="640" height="480" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment