Skip to content

Instantly share code, notes, and snippets.

@maxkfranz
maxkfranz / code.js
Last active April 11, 2017 18:36
Performance tuning
$(function(){ // on dom ready
var cy = cytoscape({
// these options hide parts of the graph during interaction
//hideEdgesOnViewport: true,
//hideLabelsOnViewport: true,
// this is an alternative that uses a bitmap during interaction
// textureOnViewport: true,
@maxkfranz
maxkfranz / code.js
Last active April 11, 2017 19:08
Multiple instances
$(function(){ // on dom ready
var elesJson = {
nodes: [
{ data: { id: 'a', foo: 3, bar: 5, baz: 7 } },
{ data: { id: 'b', foo: 7, bar: 1, baz: 3 } },
{ data: { id: 'c', foo: 2, bar: 7, baz: 6 } },
{ data: { id: 'd', foo: 9, bar: 5, baz: 2 } },
{ data: { id: 'e', foo: 2, bar: 4, baz: 5 } }
],
@maxkfranz
maxkfranz / code.js
Last active April 11, 2017 19:03
Pie style
$(function(){ // on dom ready
var cy = cytoscape({
container: document.getElementById('cy'),
style: cytoscape.stylesheet()
.selector('node')
.css({
'width': '60px',
'height': '60px',
@maxkfranz
maxkfranz / code.js
Last active April 27, 2017 08:43
qTip
$(function(){ // on dom ready
var cy = cytoscape({
container: document.getElementById('cy'),
boxSelectionEnabled: false,
autounselectify: true,
minZoom: 0.5,
maxZoom: 2,
@maxkfranz
maxkfranz / code.js
Last active February 25, 2020 06:42
Images
$(function(){ // on dom ready
// photos from flickr with creative commons license
var cy = cytoscape({
container: document.getElementById('cy'),
boxSelectionEnabled: false,
autounselectify: true,
@maxkfranz
maxkfranz / code.js
Last active August 29, 2015 14:08
GeneMANIA export
$(function(){ // on dom ready
var cy = cytoscape({
container: document.getElementById('cy'),
style: cytoscape.stylesheet()
.selector('node')
.css({
'font-size': 10,
'content': 'data(gene_name)',
@maxkfranz
maxkfranz / code.js
Last active January 24, 2017 18:50
Animated BFS
$(function(){ // on dom ready
var cy = cytoscape({
container: document.getElementById('cy'),
boxSelectionEnabled: false,
autounselectify: true,
style: cytoscape.stylesheet()
.selector('node')
@maxkfranz
maxkfranz / code.js
Last active July 5, 2016 14:23
Compound nodes
$(function(){ // on dom ready
var cy = cytoscape({
container: document.getElementById('cy'),
boxSelectionEnabled: false,
autounselectify: true,
style: [
{
@maxkfranz
maxkfranz / code.js
Last active October 21, 2015 17:31
Linkouts
$(function(){ // on dom ready
var cy = cytoscape({
container: $('#cy')[0],
boxSelectionEnabled: false,
autounselectify: true,
style: cytoscape.stylesheet()
.selector('node')
@maxkfranz
maxkfranz / code.js
Last active April 21, 2017 09:48
Visual style
$(function(){ // on dom ready
var cy = cytoscape({
container: document.getElementById('cy'),
layout: {
name: 'cose',
padding: 10,
randomize: true
},