Skip to content

Instantly share code, notes, and snippets.

@shakhal shakhal/switcher.js
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.