Layouts are algorithms that display the nodes and links in optimal positions to create a readable, unobstructed, and insightful view of the data. This allows chart users to analyze the data at a glance and quickly reveal the key insights. ReGraph offers several customizable layouts.
Depending on the data, a chart can show a single connected component, or even multiple separate components (for example, two company departments that don't interact at all).
See also the Layouts example to compare the different layouts available.
ReGraph Example
Running layouts
To set a layout, or to re-run a layout on existing data, pass an object to the layout prop with the name of the layout and any required options.
Once the layout has run and positions have been calculated, ReGraph will publish the new positions to the onChange handler. This handler is also invoked when a user drags an item.
Force-directed layouts
Force-directed layouts position nodes by running a simulation of three forces - repulsion, springs, and network energy. These calculations repel unconnected nodes apart, attract connected nodes together, and move all nodes to optimal positions.
Organic
The organic layout is the default layout in ReGraph. Organic untangles complex networks by placing connected nodes closer together and reducing link crossings.
It is a clear and reliable all-rounder for any type or size of data, and it delivers great performance even for very large datasets.
Structural
The structural layout groups together nodes with the same neighbouring nodes. This makes it easier to see the general organization of a network.
Structural gives you an overview of the clusters within a network, and allows you to see groupings and patterns without the need to focus on any one element.
Lens
The lens layout arranges nodes in a circular pattern that pushes highly-connected nodes into the centre and forces less connected nodes out into the periphery.
The circular outline makes good use of the available space and generally creates denser networks. This results in an attractive 'lens' view which highlights the key nodes in large networks.
Lens is the default layout for arranging items inside open combos. See also Arrangements in Combos.
Level layouts
Level layouts visualize data that is organized in tiers and hierarchies, or that flows from one level to another. They can use different mechanisms to assign levels to nodes:
- Assigning levels automatically to minimize link crossings and maximize the use of available space. If links have arrows, their direction is used to infer the levels.
- Assigning levels according to the content of the
leveloption. - Assigning top (sequential) / root (radial) node(s) to those specified in the
topoption. This only lays out the component(s) for whichtopis specified.
Sequential
The sequential layout is designed to display data that contains a clear sequence of links between distinct levels of nodes, or data where information flows from one level to another.
It examines link directions across the network and automatically works out where to place nodes in the hierarchy of levels in order to minimize link crossings and use all of the available screen space.
Sequential is works great with an angled link shape. You can control the layout's orientation and refine the ordering in each level using orderBy.
When space is at a premium, you can use stretch and stretchType, or stack nodes with identical connections into grids using stacking as shown in our Navigating Large Hierarchies example.
Radial
The radial layout arranges nodes in concentric circles around the original subject in a radial tree. Each 'generation' of node becomes a new ring surrounding the previous generations.
Radial is a good choice for networks where the number of child nodes significantly exceeds the number of parent nodes, as it uses the available space more efficiently for these datasets.
Packing of components
Packing is a step run during the layout that determines how unconnected chart components are placed relative to each other. It takes the unconnected components and packs them together on the chart to minimize any large gaps.
Packing is available for all layouts except the lens layout. Different layouts have different default packing, but you can also control it manually using the packing option.
Circle
Default for organic, structural and radial layouts. Lays out the components in a circular pattern. Great for space efficiency. Also suitable for sequential layout when hierarchy levels between unconnected components are irrrelevant as it makes better use of screen space.
Rectangle
Lays out the components in a grid-like rectangular pattern. Great for space efficiency and use with other rectangle-biased features such as rectangular combos. Also suitable for sequential layout when hierarchy levels between unconnected components are irrrelevant as it makes better use of screen space.
Aligned
Default for sequential layout. Lays out the components in a single line with same level items aligned to preserve the information about hierarchy of levels.
Arrangements - layouts inside combos
Items inside open combos are laid out using arrangements. Some arrangements are based on existing layouts (e.g. 'lens' or 'sequential'), others are for combos only (e.g. 'concentric' or 'grid').
See Arrangements in Combos for more details.
Performance
Our default organic layout offers the best overall performance for any size of dataset. It is especially suitable for very large charts and would be our first recommendation for most datasets.
If you need to visualize very large hierarchical data, we recommend using the sequential layout with the top or level options specified. This makes layout calculations faster than if the levels are assigned automatically.
Custom layouts
You can manually control the chart by setting the positions prop. This will prevent ReGraph's built-in layouts from running. Instead, ReGraph will animate items into position for you. You can use this to:
- Pass positions from an
onChangeevent into thepositionsprop to prevent movement during changes as seen in the Filtering Data example. - Define your own layouts:
ReGraph Example
