1e6b1ad035
* techtonik/master: Revert mixed argument patch for addNode(), because addNodes() in loadJSON already supports single string argument. Add JSON load capabilities to Springy. API change: addNode() now accepts string or Node Make demo2.html output different from demo.html
34 lines
987 B
HTML
34 lines
987 B
HTML
<html>
|
|
<body>
|
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
|
<script src="springy.js"></script>
|
|
<script src="springyui.js"></script>
|
|
<script>
|
|
var graph = new Graph();
|
|
graph.addNodes('Dennis', 'Michael', 'Jessica', 'Timothy', 'Barbara')
|
|
graph.addNodes('Amphitryon', 'Alcmene', 'Iphicles', 'Heracles');
|
|
|
|
graph.addEdges(
|
|
['Dennis', 'Michael', {color: '#00A0B0', label: 'Foo bar'}],
|
|
['Michael', 'Dennis', {color: '#6A4A3C'}],
|
|
['Michael', 'Jessica', {color: '#CC333F'}],
|
|
['Jessica', 'Barbara', {color: '#EB6841'}],
|
|
['Michael', 'Timothy', {color: '#EDC951'}],
|
|
['Amphitryon', 'Alcmene', {color: '#7DBE3C'}],
|
|
['Alcmene', 'Amphitryon', {color: '#BE7D3C'}],
|
|
['Amphitryon', 'Iphicles'],
|
|
['Amphitryon', 'Heracles'],
|
|
['Barbara', 'Timothy', {color: '#6A4A3C'}]
|
|
);
|
|
|
|
jQuery(function(){
|
|
var springy = jQuery('#springydemo').springy({
|
|
graph: graph
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<canvas id="springydemo" width="640" height="480" />
|
|
</body>
|
|
</html>
|