Last active
August 29, 2015 14:09
-
-
Save shakhal/31166e468c3130e82752 to your computer and use it in GitHub Desktop.
Cytoscape js layout switcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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