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

233
Views
how can i increment an (x,y) value for a graph location

im trying to increment the y value inside of this class "Point" which can only take an x value and a y value. is there a way that i can increment the y

for (const port of node.ports) {
        const p = new Point(-10, 0);
        const j = new Point(8,0);
        if (port.tag.portConnector.charAt(0) === "P") {
            graph.setRelativePortLocation(port, p);
        } else {
            graph.setRelativePortLocation(port, j);
        }
    }
};
about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

Either increment an external variable or use the foreach method, which provides an optional index:

node.ports.forEach((port, i) => {
        const p = new Point(-10, i * 42);
        const j = new Point(8, i + 1337 / 42);
        if (port.tag.portConnector.charAt(0) === "P") {
            graph.setRelativePortLocation(port, p);
        } else {
            graph.setRelativePortLocation(port, j);
        }
    })
about 4 years ago · Santiago Gelvez Report

0

From the documentation, you might wanna try:

const additionalY = 10 //Or any amount you wanna increase
const addition = new Point(0, additionalY )
const newPoint = p.add(addition)
about 4 years ago · Santiago Gelvez Report
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!