Comments (5)
@alico-cra I'm unable to reproduce your issue. Could you make a simple example on https://codesandbox.io/ that clearly shows the problem you're describing?
And if you try this example you'll notice that the custom links are visible immediately, not when the user interacts with the graph. Do you observe a different behaviour?
from react-force-graph.
@vasturiano Here is the link to an example codesandbox displaying the issue.
Essentially, the issue is present when I am rendering some default data that is not fetched, then once the data I wish to display has been fetched, the UI is re-rendered with said new graph. In this example, there is a "Load Data" button which will simulate fetching data that is not initially rendered.
- Click on the
Load Data
button - Next, you should see 4 nodes present. Notice that there are NO VISIBLE LINKS between them.
- Now, move your cursor in the area between 2 nodes.
- Only once the cursor hovers across a non-visible link do all the links become visible.
- Once the links become interacted with/visible, they follow the appropriate hover opacity & color logic I have set up in this example.
This only occurs when defining linkThreeObject
. I would expect that as soon as the button is pressed & refresh occurs, the links would be present along with the nodes. However, it seems like something is conflicting between the initial linkOpacity={0}
and the opacity for links set in linkThreeObject
. A link must be physically interacted with by the mouse in order to be rendered visible with linkThreeObject in this example.
Am I missing something simple? Thanks in advance for the input.
from react-force-graph.
As @alico-cra noted, I'm able to recreate this issue if I define a custom node AND link. With link only example (the text-label @vasturiano pointed to) I don't see the issue.
I do notice that @vasturiano uses linkPositionUpdate
to set link position while @alico-cra we are setting it in the linkThreeObject code - maybe this change would help?
I started a new sandbox but was not able to fully replicate, although I do have other issues with the links not positioning correctly which are maybe related?
https://codesandbox.io/p/sandbox/purple-morning-ntr2zf?file=%2Fsrc%2FForceGraph.jsx%3A57%2C9
from react-force-graph.
@cramatt Yes that is a good point worth clarifying. The text-label example does work for me as well.
However the difference in that example vs what I noted in this bug is that the issue seems to be present when newer content is present after initial render, and after a refresh occurs, the new links are present in the canvas but not visible. They almost seem to be defaulting to the linkOpacity={0}
rather than the styling dictated in linkThreeObject.
from react-force-graph.
Thanks for creating those examples.
Like @cramatt already mentioned, the issue is that you're not implementing the linkPositionUpdate
method. This method is essential when you have custom links because the module has no way to know how to generically do that. The method linkThreeObject
gets invoked only at object creation, but linkPositionUpdate
gets invoked at every frame in which there is node movement.
You can see an example of that implementation here:
react-force-graph/example/text-links/index-3d.html
Lines 33 to 40 in ac46439
from react-force-graph.
Related Issues (20)
- Problem integrating react-force-graph-2d in a react with TypeScript project HOT 1
- Cannot use import statement outside a module for react-kapsule from react-force-graph-2d HOT 4
- How to implement cluster area with nodes inside?
- Expanded nodes by default when rendering HOT 4
- Attempted import error: 'AmbientLight' is not exported from 'three'. HOT 1
- "Highlights" example not working for me HOT 4
- Unable to Display Node Text in Stage Environment? HOT 1
- Can't access node position in nodeThreeObject HOT 7
- DOMException on CustomElementRegistry when using multiple modules HOT 2
- enable zooming, panning and rotating separately for 3d graph HOT 1
- how to prevent endless re-rendering? HOT 1
- How to draw curved lines between nodes HOT 2
- Any ideas how to implement curved connections as on screenshoot HOT 2
- appending nodes gives: Cannot create property 'vx' on string
- Performance issue when utilizing Parcel to build project.
- How to have coordinates of real positions of nodes according to the window when zoom in on hover HOT 2
- how to stop force directed graph from moving the nodes?
- how to get a graph with less spacing? HOT 3
- How can i add minimap for graph? HOT 1
- Uncaught TypeError: object null is not iterable HOT 1
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.