Package com.storedobject.chart
Class GraphData.Force
java.lang.Object
com.storedobject.chart.GraphData.Force
- All Implemented Interfaces:
ComponentProperty
- Enclosing class:
GraphData<N extends GraphData.Node>
Represents a force-directed layout configuration as a property of a chart component.
This class defines various attributes that influence the behavior and appearance
of the force-directed layout, such as repulsion, gravity, friction, edge length, and
the initial layout configuration.
- Author:
- Syam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionedgeLength(double edgeLength) Sets the edge length for the force and returns the current instance of the Force object.voidEncode the JSON string with the properties of this.friction(double friction) Sets the friction value for this force instance.doubleRetrieves the edge length value.doubleRetrieves the friction value.doubleRetrieves the gravity value.Retrieves the initial layout configuration.intRetrieves the repulsion value.gravity(double gravity) Sets the gravity parameter and returns the currentGraphData.Forceobject.initialLayout(GraphData.Layout initialLayout) Sets the initial layout for theForceinstance.booleanDetermines whether layout animation is enabled or not.layoutAnimation(boolean layoutAnimation) Enables or disables layout animation for the force layout.repulsion(int repulsion) Sets the repulsion value for the force configuration.voidsetEdgeLength(double edgeLength) Sets the length of edges in the layout.voidsetFriction(double friction) Sets the friction value for the force calculations.voidsetGravity(double gravity) Sets the value for the gravitational force to be applied.voidsetInitialLayout(GraphData.Layout initialLayout) Sets the initial layout of the force-directed graph.voidsetLayoutAnimation(boolean layoutAnimation) Enables or disables the layout animation.voidsetRepulsion(int repulsion) Sets the repulsion value.
-
Constructor Details
-
Force
public Force()
-
-
Method Details
-
getInitialLayout
Retrieves the initial layout configuration.- Returns:
- The initial
Layoutconfiguration, which defines the structural arrangement.
-
initialLayout
Sets the initial layout for theForceinstance.- Parameters:
initialLayout- the layout to be used as the initial layout. This specifies the arrangement model to apply at the start.- Returns:
- the current
Forceinstance for method chaining.
-
setInitialLayout
Sets the initial layout of the force-directed graph.- Parameters:
initialLayout- The layout to be set as the initial layout. It specifies the arrangement model such as FORCE, CIRCULAR, or NONE.
-
getRepulsion
public int getRepulsion()Retrieves the repulsion value.- Returns:
- The value of the repulsion parameter.
-
repulsion
Sets the repulsion value for the force configuration.- Parameters:
repulsion- The repulsion value to set.- Returns:
- The current instance of the
Forceobject.
-
setRepulsion
public void setRepulsion(int repulsion) Sets the repulsion value.- Parameters:
repulsion- the repulsion value to be set, typically used to control the spacing or force applied between nodes in a layout.
-
getGravity
public double getGravity()Retrieves the gravity value.- Returns:
- The current gravity value as a double.
-
gravity
Sets the gravity parameter and returns the currentGraphData.Forceobject.- Parameters:
gravity- The gravity value to be set.- Returns:
- The current
GraphData.Forceobject with the updated gravity value.
-
setGravity
public void setGravity(double gravity) Sets the value for the gravitational force to be applied.- Parameters:
gravity- The gravitational force value to be set.
-
getFriction
public double getFriction()Retrieves the friction value.- Returns:
- The current friction value.
-
friction
Sets the friction value for this force instance.- Parameters:
friction- The friction value to set. It represents the resistance force that opposes motion.- Returns:
- This
Forceinstance for method chaining.
-
setFriction
public void setFriction(double friction) Sets the friction value for the force calculations.- Parameters:
friction- The friction coefficient to be set. This value typically affects the rate of deceleration or resistance within the force model.
-
getEdgeLength
public double getEdgeLength()Retrieves the edge length value.- Returns:
- The current edge length as a double.
-
edgeLength
Sets the edge length for the force and returns the current instance of the Force object.- Parameters:
edgeLength- the length of the edges.- Returns:
- the current instance of the Force object.
-
setEdgeLength
public void setEdgeLength(double edgeLength) Sets the length of edges in the layout.- Parameters:
edgeLength- the desired length of edges
-
isLayoutAnimation
public boolean isLayoutAnimation()Determines whether layout animation is enabled or not.- Returns:
- true if layout animation is enabled, false otherwise.
-
layoutAnimation
Enables or disables layout animation for the force layout.- Parameters:
layoutAnimation- A boolean value indicating whether layout animation should be enabled (true) or disabled (false).- Returns:
- The current instance of the
Forceobject for method chaining.
-
setLayoutAnimation
public void setLayoutAnimation(boolean layoutAnimation) Enables or disables the layout animation.- Parameters:
layoutAnimation- Specifies whether the layout animation should be enabled (true) or disabled (false).
-
encodeJSON
Description copied from interface:ComponentPropertyEncode the JSON string with the properties of this.- Specified by:
encodeJSONin interfaceComponentProperty- Parameters:
sb- Encoded JSON string to be appended to this.
-