Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
Get x and y coordinates of each node react-graph-vis

When the graph gets rendered it gives each node its x and y coordinates. My question is can I access the network and get each node coordinates. I tried using ref in order to print out the network and get the nodes details but I couldn't find anything about coordinates. please note that I'm new to react-graph-vis so go easy on me.

import React from "react";
import ReactDOM from "react-dom";
import Graph from "react-graph-vis";



function App() {
 const graph = {
   nodes: [
     { id: 1, label: "Node 1", title: "node 1 tootip text" },
     { id: 2, label: "Node 2", title: "node 2 tootip text" },
     { id: 3, label: "Node 3", title: "node 3 tootip text" },
     { id: 4, label: "Node 4", title: "node 4 tootip text" },
     { id: 5, label: "Node 5", title: "node 5 tootip text" }
   ],
   edges: [
     { from: 1, to: 2 },
     { from: 1, to: 3 },
     { from: 2, to: 4 },
     { from: 2, to: 5 }
   ]
 };

 const options = {
    width: (window.innerWidth) + 'px',
   height: (window.innerWidth) + 'px',
   layout: {
       hierarchical: false
   },
   edges: {
       color: "#000000"
   },
   physics:false,
   interaction: {
       dragNodes: true,
       zoomView: true,
       dragView: true 
   }
 };
 const events = {
   select: function(event) {
     var { nodes, edges } = event;
   }
 };
 return (
   <Graph
     graph={graph}
     options={options}
     events={events}
     getNetwork={network => {
      
     }}
   />
 );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda