Nickolasmv / cytoscape-ngraph.forcelayout

Other
9 stars 9 forks source link

Use together with ReactJS #5

Open sfbrunner opened 6 years ago

sfbrunner commented 6 years ago

Hi Nickolas, Thanks for this cytoscape extension - it really is a very fast and well-rendering layout! I am working on a React-based project and would like to integrate a network visualisation, ideally using your layout. I npm installed your package and do the following to load it

var cytoscape = require('cytoscape');
var cyforcelayout = require('cytoscape-ngraph.forcelayout');
cyforcelayout( cytoscape );

Then if I pass cyforcelayout straight into the cy div, I get all nodes positioned in a grid. It appears that I do not know how to change the parameters of the layout in this way at all. Alternatively, if I specify the layout as follows, then I get an error log, saying that 'cytoscape-ngraph.forcelayout' cannot be found:

var cytoForceLayout = {
    name: 'cytoscape-ngraph.forcelayout',
    [ ... other options ... ]
}

Thus, my question is, in ReactJS, how can I use your package and customise its parameters?

JohnForster commented 4 years ago

I'm getting an error cy.cyforcelayout() is not a function