Comments (5)
@bt2414 you need to get the ref
to the element from React, like in this example:
https://github.com/vasturiano/react-force-graph/blob/master/example/dynamic/index.html#L59
from react-force-graph.
@vasturiano Hi, I think I have already used the this.ref, in my code I just used:
this.fg.nodeRelSize(4);
But it gives me the function is not found problem:
app.js:92041 Uncaught TypeError: this.fg.nodeRelSize is not a function
at GraphCom.clickChangeColor (app.js:92041)
at onClick (app.js:92089)
at Button._this.handleClick (app.js:92227)
at HTMLUnknownElement.boundFunc (app.js:56065)
at Object.ReactErrorUtils.invokeGuardedCallback (app.js:56071)
at executeDispatch (app.js:55856)
at Object.executeDispatchesInOrder (app.js:55879)
at executeDispatchesAndRelease (app.js:5018)
at executeDispatchesAndReleaseTopLevel (app.js:5029)
at Array.forEach ()
Could you give me an idea about where goes wrong?
Thanks so much.
from react-force-graph.
@bt2414 nodeRelSize
is a prop, not a method. So, you can use it the conventional way in your React component, no need to invoke it on the ref:
<ForceGraph3D
graphData={data}
nodeRelSize={4}
/>
from react-force-graph.
@vasturiano I need to use it for future updating the graph.
As I mentioned in:
It can access the function by using:
Graph.nodeRelSize(this.relSize);
Do you have any idea about how to do it?
from react-force-graph.
@bt2414 you can just rely on React's update lifecycle to pass different values to that prop, using the component's state for example. Something like:
render() {
return <ForceGraph3D
graphData={data}
nodeRelSize={this.state.nodeSize}
/>
}
The nodes sizes will update every time the value of state.nodeSize
changes.
from react-force-graph.
Related Issues (20)
- How to use useRef with Typescript? HOT 1
- It There a way to remove the bottom text of the graph?
- ReferenceError: self is not defined NextJS app router HOT 4
- Cannot add threejs object in the current ref scene
- BackgroundColor: white is not working propertly HOT 1
- Unable to get the dynamic position of the node HOT 2
- is there a way to keep the gentle floating movement after the initial graph animation? HOT 3
- Is it possible to incorporate a lasso selection? HOT 2
- d3Force is not a function HOT 2
- How to modify the canvas in 3d graph (canvas touchAction = "auto!important") HOT 1
- Performance issues with 80k+ edges
- A problem with pReact and react-kapsule script in a production environment HOT 3
- Centering on a node when more nodes are added as children to that node. HOT 1
- Three Js Dependency issue HOT 1
- dag mode + custom node shapes
- Links are not updating correctly HOT 4
- When nodeThreeObject is used, three-spritetext gives an error HOT 1
- Add a minimap to visualize one's locatin in huge graphs HOT 2
- graphRef.current.cameraPosition undefined
- Attempting to implement instancing for edges + nodes
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-force-graph.