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.void
Encode the JSON string with the properties of this.friction
(double friction) Sets the friction value for this force instance.double
Retrieves the edge length value.double
Retrieves the friction value.double
Retrieves the gravity value.Retrieves the initial layout configuration.int
Retrieves the repulsion value.gravity
(double gravity) Sets the gravity parameter and returns the currentGraphData.Force
object.initialLayout
(GraphData.Layout initialLayout) Sets the initial layout for theForce
instance.boolean
Determines 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.void
setEdgeLength
(double edgeLength) Sets the length of edges in the layout.void
setFriction
(double friction) Sets the friction value for the force calculations.void
setGravity
(double gravity) Sets the value for the gravitational force to be applied.void
setInitialLayout
(GraphData.Layout initialLayout) Sets the initial layout of the force-directed graph.void
setLayoutAnimation
(boolean layoutAnimation) Enables or disables the layout animation.void
setRepulsion
(int repulsion) Sets the repulsion value.
-
Constructor Details
-
Force
public Force()
-
-
Method Details
-
getInitialLayout
Retrieves the initial layout configuration.- Returns:
- The initial
Layout
configuration, which defines the structural arrangement.
-
initialLayout
Sets the initial layout for theForce
instance.- Parameters:
initialLayout
- the layout to be used as the initial layout. This specifies the arrangement model to apply at the start.- Returns:
- the current
Force
instance 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
Force
object.
-
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.Force
object.- Parameters:
gravity
- The gravity value to be set.- Returns:
- The current
GraphData.Force
object 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
Force
instance 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
Force
object 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:ComponentProperty
Encode the JSON string with the properties of this.- Specified by:
encodeJSON
in interfaceComponentProperty
- Parameters:
sb
- Encoded JSON string to be appended to this.
-