Giter VIP home page Giter VIP logo

Comments (5)

kstewart83 avatar kstewart83 commented on May 24, 2024 2

I was having a similar issue. Per the Cytoscape Documentation, the new layout needs to be created and run when the elements have been updated. Not sure this is exposed through the React side of things, but it is easy to get the original Cytoscape object. So in my component code I have something like:

componentWillUpdate = () => {
    if(this.cy) {
      var layout = this.cy.layout({name: 'cose-bilkent'})
      layout.run();
    }
  }

And the element looks like this:

<CytoscapeComponent 
          elements={this.state.elements} 
          style={{ width: '100vw', height: '85vh', backgroundColor: 'rgb(250, 250, 250)' }}
          layout={{name: 'cose-bilkent'}}
          cy={(cy:any) => (this.cy = cy)}
 />

That seems to work.

from react-cytoscapejs.

maxkfranz avatar maxkfranz commented on May 24, 2024

You have no positions defined on the nodes so they default to (0,0)

from react-cytoscapejs.

meisam-sorkhabi avatar meisam-sorkhabi commented on May 24, 2024

Thank you - it is resolved.

from react-cytoscapejs.

Jeffrang avatar Jeffrang commented on May 24, 2024

You have no positions defined on the nodes so they default to (0,0)

The actual cytoscape supports without even passing position. Isnt that supported in the react version?

from react-cytoscapejs.

mariela-plaza avatar mariela-plaza commented on May 24, 2024

You have no positions defined on the nodes so they default to (0,0)

The actual cytoscape supports without even passing position. Isnt that supported in the react version?

I am currently having the same issue. So far I've been using only the cytoscape.js library and it has worked great. I haven't had to define position on the nodes for the graph to work correctly.

What I don't understand is why we don't have to define positions for the nodes when we are not fetching the data but when we do we have to define them.

This project is working perfectly without fetching data but as soon as I try to make something similar but fetching the data from an API and then doing the mapping myself, the whole Cytoscape Graph becomes messy.

from react-cytoscapejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.