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
35 lines
631 B
HTML
35 lines
631 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.loadJSON(
|
|
{
|
|
"nodes": [
|
|
'Amphitryon',
|
|
'Alcmene',
|
|
'Iphicles',
|
|
'Heracles'
|
|
],
|
|
"edges": [
|
|
['Amphitryon', 'Alcmene'],
|
|
['Alcmene', 'Amphitryon'],
|
|
['Amphitryon', 'Iphicles'],
|
|
['Amphitryon', 'Heracles']
|
|
]
|
|
}
|
|
);
|
|
|
|
jQuery(function(){
|
|
var springy = jQuery('#springydemo').springy({
|
|
graph: graph
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<canvas id="springydemo" width="640" height="480" />
|
|
</body>
|
|
</html>
|