Cytoscape.js and Generic JavaScript View

Hi all, I'm trying to draw graphs in Knime with the Generic JavaScript View using the Cytoscape.js API, I used JQuery to import it in the node, but when the function cytoscape is called, nothing after it, is executed, I checked if the loading was correct, it is (I put an alert instead of the creation of the graph and it worked). I ran out of ideas, Can you help me please?

I attached a knime workflow with this node.

I use the version 3.3.1.

Thanks in advance,

Gengeal

Hi Gengeal,

I had a quick look at your code. Attached is a working example.

The node uses requireJS to load the default dependencies (jQuery, d3) at runtime. Cytoscape detects in it's loading routine if requireJS is present and reacts accordingly. In this case it calls define() instead of registering the global cytoscape variable.
I adapted the code, so that requireJS is used to load cytoscape. Note the extra 'cytoscape' variable in the require call that is passed in instead of a global variable.

I would also like to mention that we are currently developing a new 'Network View' node that is going to be based on cytoscape. This will be available with the new 3.4 release in summer.

Let me know if you have any further questions.

Best regards,
Christian

It helped me a lot.

Really thank you.

Gengeal