Comments (5)
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.
You have no positions defined on the nodes so they default to (0,0)
from react-cytoscapejs.
Thank you - it is resolved.
from react-cytoscapejs.
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.
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)
- ReferenceError: window is not defined when refresshing the page.
- Maximum call stack size exceeded HOT 1
- How to use ctxmenu in this component?
- Issues with React 18 StrictMode HOT 4
- Next.js uses cjs module loader resulting in SyntaxError: Cannot use import statement outside a module HOT 2
- TS: cannot find module error
- nodes selction is not working
- Canvas elements moved by 50% to the right of the CytoscapeComponent HOT 2
- v2.0 has demo target missing HOT 7
- resize CytoscapeComponent
- updates to component HOT 2
- Createportal / react-cytoscape HOT 1
- Microbundle Compile Error Next.js HOT 1
- Support automatically check/uncheck link between two nodes
- Question: Could the nodes be interactive? HOT 2
- Question: Update to React 18? HOT 2
- Question: Styling & Layout HOT 1
- Infinite render graph force-directed on parameter "randomize": false
- Module not found: Can't resolve 'react-cytoscapejs' in Nextjs
- TypeError: renderer is null HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-cytoscapejs.