ZoomCharts Documentation

Version: 1.21.1 (2024-11-08)

NetChart.settings.layout.gravity

This section is defined by the type NetChartGravitySettings.
Introduced in version 1.17.0.

For dynamic layout, settings for gravity that pulls all nodes together.

Properties

from: "auto" | "node" | "cluster"
Default value: "auto"
Introduced in version 1.17.0.

The object affected by the gravity effect in the dynamic layout.

Valid values:
  • node - Gravity force is applied to each node individually
  • cluster - Gravity force is applied to the cluster as a whole.
  • auto - Select value automatically based on data. If to="nearestLockedNode" then always selects "node"
fromCenter: "weighted" | "geometric"
Default value: "weighted"
Introduced in version 1.17.0.

How to find the center of the object which is affected by gravity. Only used if from="cluster". Only non-locked nodes will be used to calculate the center.

Valid values:
  • weighted - Use the weighted center of the nodes, using node radius as their weight
  • geometric - Use the center of a circle which is circumscribed around the nodes.
strength: number
Default value: 0.01
Introduced in version 1.17.0.

Strength of the gravity effect. This does not have any tangible units but is rather a factor that is used in the calculations. If you want to tweak it, experiment until you find a suitable value. Larger values will mean a stronger gravity, smaller will mean weaker. Negative values are allowed and will reverse the effect, but are unlikely to be useful - unlike "traditional" Newtonian gravity, this one actually gets stronger as the nodes get further away from the center, so the result of a negative value will be uncontrolled, exponential expansion. Setting to 0 disables gravity entirely.

to: "cluster" | "nearestLockedNode" | "clusterLockedNodes" | "graph" | "graphLockedNodes"
Default value: "graph"
Introduced in version 1.17.0.

The object to which the gravity attracts the affected object.

Valid values:
  • nearestLockedNode - attract to the nearest locked node. Only valid if from="node" or from="auto".
  • cluster - the center of all nodes in the cluster
  • clusterLockedNodes - the center of all locked nodes in the cluster
  • graph - the center of all nodes in the graph
  • graphLockedNodes - the center of all locked nodes in the graph
toCenter: "weighted" | "geometric"
Default value: "weighted"
Introduced in version 1.17.0.

How to find the center of the object to which the gravity attacts. Not used if to="nearestLockedNode".

Valid values:
  • weighted - Use the weighted center of the nodes, using node radius as their weight
  • geometric - Use the center of a circle which is circumscribed around the nodes.
X