Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!