Search

Positioning Nodes

Basics

Nodes in the chart can be positioned either using layouts, or using coordinates. The right positioning of items in the chart helps to detangle the data and visualize how items are connected.

Layouts transform connected data into networks that highlight connections, patterns and outliers which would be difficult to spot in the raw data. You can run a layout by passing an object with the layout name to the layout prop, which applies to any nodes with no specified coordinates. ReGraph uses the organic layout by default. See also the Layouts documentation for details.

Alternatively, you can pass an object with custom node coordinates to the positions prop, which will move nodes into the specified positions. See also the Custom Layouts documentation for details.

When using organic layout, the two ways can be combined - passing coordinates into positions prop fixes these nodes in the chart even when organic layout is run.

There are two types of x and y coordinates:

  • World coordinates represent absolute positions within the chart, where 0, 0 is the center of the chart. They correspond exactly to the positions of a node. When integrating with Leaflet, world coordinates are represented as lng and lat.
  • View coordinates represent pixel positions relative to the viewport, where 0, 0 is the top-left corner of the view. Positions of events such as onClick are reported in view coordinates. View coordinates change whenever the user pans the view.

You can convert between the two options using the viewCoordinates and worldCoordinates instance methods.

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.