cytoscape / cytoscape.js

Graph theory (network) library for visualisation and analysis
https://js.cytoscape.org
MIT License
10.08k stars 1.64k forks source link

console says layout.run is not a function but still works as defined #1777

Closed solo7773 closed 7 years ago

solo7773 commented 7 years ago

Dear cytoscape contributor, when I try to render a new layout after initialisation, the console gives the error detailed below, but the layout can be successfully rendered in the browser. How could I avoid this annoying fake error? Thanks!

var newLayout = cy.layout({name: 'cose'}); newLayout.run();

os: windows 7 x64 cytoscape V 2.7.16 jQuery V 3.2.1

chrome V 57.0.2987.133 Uncaught TypeError: newLayout.run is not a function at creatNetwork (viewnetwork.php:234) at Object.success (viewnetwork.php:188) at i (jquery.min.js:2) at Object.fireWith [as resolveWith] (jquery.min.js:2) at A (jquery.min.js:4) at XMLHttpRequest. (jquery.min.js:4)

IE V 11.0.9600.18617 Object doesn't support property or method 'run'

Kawrantin commented 7 years ago

Same error here, I'm trying to set a qTips like :

cy.nodes().qtip({ content: function() { return "Nb instances : " + this.data('instances'); }, style: { classes: 'qtip-bootstrap' }, position: { my: 'bottom center', at: 'top center' }, show: { effect: function() { $(this).slideDown(); } }, hide: { effect: function() { $(this).slideUp(); } } });

And I get :

TypeError: ele.scratch is not a function

The graph generation works, but there is no layout and no qTips. All was ok before the 3.0.0, I changed cytoscape.js and cytoscape.min.js in 2.7 but nothing happened

maxkfranz commented 7 years ago

If you want to use 3.x APIs, you have to use cytoscape@^3.0.0. If you want to reference the 2.x docs, you can

git clone https://github.com/cytoscape/cytoscape.js.git
cd cytoscape.js
git checkout 2.x

Then open ./documentation.

solo7773 commented 7 years ago

Thanks Max. I didn't realise I referred to a wrong document. Now everything works very well.

solo7773 commented 7 years ago

Hi Kawrantin, I haven't used tip function in 3.0, I am not sure I will face the error you pointed. Let me figure out first.