Hello all,
I'm new to cytoscape.js, so forgive me if this is a very basic question. I found
this q&a in stackoverflow but I could not quite understand how it solved the problem.
I have a cysj file that I exported from Cytoscape 3.1.1, and I want to open this file in cytoscape.js.
I have the following example script in my html page and instead of embedding elements into this code, I want to read them from the cysj json file.
$(function(){
var cy = window.cy = cytoscape({
container: document.getElementById('cy'),
layout: {
name: 'cose',
idealEdgeLength: 100,
nodeOverlap: 20
},
style: [{..........}}],
elements: {
nodes: [
{ data: { id: 'n0' } },
{ data: { id: 'n1' } },
{ data: { id: 'n2' } },
{ data: { id: 'n3' } },
{ data: { id: 'n4' } },
{ data: { id: 'n5' } },
{ data: { id: 'n6' } },
{ data: { id: 'n7' } },
{ data: { id: 'n8' } },
{ data: { id: 'n9' } },
{ data: { id: 'n10' } },
],
edges: [
{ data: { source: 'n0', target: 'n1' } },
{ data: { source: 'n1', target: 'n2' } },
{ data: { source: 'n1', target: 'n3' } },
{ data: { source: 'n4', target: 'n5' } },
{ data: { source: 'n4', target: 'n6' } },
{ data: { source: 'n6', target: 'n7' } },
{ data: { source: 'n6', target: 'n8' } },
{ data: { source: 'n8', target: 'n9' } },
{ data: { source: 'n8', target: 'n10' } },
]
},
});
});
Thanks in advance,
Dolunay