Package com.storedobject.chart
Class PointSymbol
java.lang.Object
com.storedobject.chart.PointSymbol
- All Implemented Interfaces:
ComponentProperty
,VisibleProperty
- Direct Known Subclasses:
GraphData.Category
Represents the symbol used to draw a point on the chart. (Example usage is in
LineChart
).- Author:
- Syam
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for thePointSymbol
class.PointSymbol
(PointSymbolType type) Constructs a PointSymbol with the specifiedPointSymbolType
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Encode the JSON string with the properties of this.getOffset
(boolean createIfNotExists) Retrieves the offset for the point symbol.final PointSymbolType
getType()
Retrieves the current type of the point symbol.boolean
Checks if this property is currently visible.Sets the offset for thePointSymbol
and returns the updated instance.void
setHoverAnimation
(boolean hoverAnimation) Sets the hover animation property for the symbol.void
Sets the offset for the point symbol.void
setSize
(int size) Sets the size of the point symbol based on the given value.void
setSize
(int width, int height) Sets the size of the symbol using specified width and height values.void
setType
(PointSymbolType pointSymbolType) Sets the type of the point symbol.void
Sets the URL for the point symbol.void
setVisible
(boolean visible) Sets the visibility of this property.size
(int size) Sets the size of the point symbol and returns the updatedPointSymbol
instance.size
(int width, int height) Updates the size of the point symbol using the specified width and height values.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.chart.VisibleProperty
hide, show
-
Constructor Details
-
PointSymbol
public PointSymbol()Default constructor for thePointSymbol
class. Creates aPointSymbol
with the default symbol typePointSymbolType.CIRCLE
. -
PointSymbol
Constructs a PointSymbol with the specifiedPointSymbolType
.- Parameters:
type
- The type of the point symbol to be used.
-
-
Method Details
-
setURL
Sets the URL for the point symbol. The URL should start with either "image://" or "path://". If it starts with "image://", then the URL should be a valid URL pointing to an image, and if it starts with "path://", then it should be valid SVG code. If the provided URL is null, empty, or does not start with valid prefixes, the URL is set to null. Additionally, the point symbol type is ignored when a valid URL is provided.- Parameters:
url
- The URL to be set for the point symbol. Valid URLs should start with either "image://" or "path://".
-
setVisible
public void setVisible(boolean visible) Description copied from interface:VisibleProperty
Sets the visibility of this property.- Specified by:
setVisible
in interfaceVisibleProperty
- Parameters:
visible
- A boolean indicating whether this property should be visible (true) or hidden (false).
-
isVisible
public boolean isVisible()Description copied from interface:VisibleProperty
Checks if this property is currently visible.- Specified by:
isVisible
in interfaceVisibleProperty
- Returns:
- true if the property is visible, false otherwise.
-
setType
Sets the type of the point symbol.- Parameters:
pointSymbolType
- The type of the point symbol to assign.
-
getType
Retrieves the current type of the point symbol.- Returns:
- The current
PointSymbolType
of the point symbol.
-
setSize
public void setSize(int size) Sets the size of the point symbol based on the given value. If the input size is less than or equal to zero, the size will be set to null. Otherwise, the size is set to the string representation of the given value.- Parameters:
size
- The size of the point symbol to set. A positive value sets the size, while a non-positive value resets it to null.
-
size
Sets the size of the point symbol and returns the updatedPointSymbol
instance. The size determines the visual dimensions of the point symbol.- Parameters:
size
- The size of the point symbol to set. A positive value assigns the size, while a non-positive value resets the size tonull
.- Returns:
- The updated
PointSymbol
instance with the specified size applied.
-
setSize
public void setSize(int width, int height) Sets the size of the symbol using specified width and height values.- Parameters:
width
- The width of the symbol. Should be a positive value.height
- The height of the symbol. Should be a positive value. If both width and height are not positive, the size will be set to null. If only one of width or height is positive, the size will be adjusted accordingly by reusing other overloads of this method.
-
size
Updates the size of the point symbol using the specified width and height values. The size defines the visual dimensions of the point symbol and influences its rendering within the chart.- Parameters:
width
- The width of the point symbol. Should be a positive value. If width is non-positive, the size may be reset depending on height value.height
- The height of the point symbol. Should be a positive value. If height is non-positive, the size may be reset depending on width value.- Returns:
- The updated
PointSymbol
instance with the specified size applied.
-
setHoverAnimation
public void setHoverAnimation(boolean hoverAnimation) Sets the hover animation property for the symbol. When enabled, the symbol will display animations on hover, typically enhancing the visual interaction for users.- Parameters:
hoverAnimation
- Specifies whether the hover animation should be enabled or disabled. A value oftrue
enables the animation, whilefalse
disables it.
-
setOffset
Sets the offset for the point symbol. The offset determines the horizontal (x-axis) and vertical (y-axis) displacement of the symbol.- Parameters:
offset
- The offset to be set for the point symbol. It specifies the x and y offsets in relation to the default position.
-
offset
Sets the offset for thePointSymbol
and returns the updated instance.- Parameters:
offset
- TheOffset
to be applied to thePointSymbol
.- Returns:
- The updated
PointSymbol
instance with the specified offset applied.
-
getOffset
Retrieves the offset for the point symbol. If the offset does not already exist and thecreateIfNotExists
parameter istrue
, a newOffset
instance will be created.- Parameters:
createIfNotExists
- A boolean flag indicating whether to create a newOffset
instance if none exists. Iftrue
, a new offset will be created when it does not exist; otherwise,null
will be returned if it does not already exist.- Returns:
- The
Offset
instance associated with the point symbol. May returnnull
if no offset exists andcreateIfNotExists
isfalse
.
-
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.
-