Open nicola-attico opened 1 year ago
@nicola-attico please see https://vasturiano.github.io/3d-force-graph/example/text-nodes/
Thanks, @vasturiano. Yes, I saw this one, but I don't see how I can keep the node like appearance (the sphere) and the text as well, like in the native label visualization. How can that be done?
@nicola-attico nodeThreeObjectExtend
defines whether the custom node object implementation should replace the existing default mode (as in the above example), or simply extend it so you get both.
Essentially you just need to set nodeThreeObjectExtend(true)
.
@nicola-attico hey,did you kown how to keep the node like appearance (the sphere) already? did you solve the problem?
@nicola-attico hey,you can do like this. it will be okay. .nodeThreeObject((node) => { const geometry = new THREE.SphereGeometry(sphereRadius); const material = new THREE.MeshPhongMaterial(); const nodeSphere = new THREE.Mesh(geometry, material); const label = new SpriteText(node.label); label.material.depthWrite = false; // make sprite background transparent label.textHeight = 2; label.color = '#ffffff'; label.position.set(0, -8, 0); nodeSphere.add(label); return nodeSphere; })
Hi, how can I show the labels for multiple nodes of the graph, not just the one I'm hovering on?
G.nodeLabel seems only to set the label, not say when this is displayed.
Thanks, Nicola