Skip to content

Instantly share code, notes, and snippets.

@shakhal
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shakhal/31166e468c3130e82752 to your computer and use it in GitHub Desktop.
Save shakhal/31166e468c3130e82752 to your computer and use it in GitHub Desktop.
Cytoscape js layout switcher
$(function(){ // on dom ready
var html = layouts.reduce(function(a,e,i){return a+"<a onclick='setLayout("+i+")'>"+e+"</a> - "},"Layouts:")
$("#cy").before(html);
}); // on dom ready
var layouts = [ 'concentric',
'breadthfirst',
'circle',
'springy',
'grid',
'cola',
'cose',
'arbor',
'dagre',
'preset'
];
function setLayout(i){
cy.layout({name: layouts[i]})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment