Cytoscape test: Difference between revisions
From FANTOM5_SSTAR
No edit summary |
No edit summary |
||
Line 88: | Line 88: | ||
// init and draw | // init and draw | ||
var vis = new org.cytoscapeweb.Visualization(div_id, options); | var vis = new org.cytoscapeweb.Visualization(div_id, options); | ||
// callback when Cytoscape Web has finished drawing | |||
vis.ready(function() { | |||
// add a listener for when nodes and edges are clicked | |||
vis.addListener("dblclick", "nodes", function(event) { | |||
handle_click(event); | |||
}) | |||
.addListener("dblclick", "edges", function(event) { | |||
handle_click(event); | |||
}); | |||
function handle_click(event) { | |||
var target = event.target; | |||
alert("Link to "+event.group+" "+target.data["id"]); | |||
} | |||
}); | |||
vis.draw(draw_options); | vis.draw(draw_options); | ||
}; | }; |
Revision as of 13:14, 23 April 2012
Cytoscape Web will replace the contents of this div with your graph.