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 thePointSymbolclass.PointSymbol(PointSymbolType type) Constructs a PointSymbol with the specifiedPointSymbolType. -
Method Summary
Modifier and TypeMethodDescriptionvoidEncode the JSON string with the properties of this.getOffset(boolean createIfNotExists) Retrieves the offset for the point symbol.final PointSymbolTypegetType()Retrieves the current type of the point symbol.booleanChecks if this property is currently visible.Sets the offset for thePointSymboland returns the updated instance.voidsetHoverAnimation(boolean hoverAnimation) Sets the hover animation property for the symbol.voidSets the offset for the point symbol.voidsetSize(int size) Sets the size of the point symbol based on the given value.voidsetSize(int width, int height) Sets the size of the symbol using specified width and height values.voidsetType(PointSymbolType pointSymbolType) Sets the type of the point symbol.voidSets the URL for the point symbol.voidsetVisible(boolean visible) Sets the visibility of this property.size(int size) Sets the size of the point symbol and returns the updatedPointSymbolinstance.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, waitMethods inherited from interface com.storedobject.chart.VisibleProperty
hide, show
-
Constructor Details
-
PointSymbol
public PointSymbol()Default constructor for thePointSymbolclass. Creates aPointSymbolwith 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:VisiblePropertySets the visibility of this property.- Specified by:
setVisiblein interfaceVisibleProperty- Parameters:
visible- A boolean indicating whether this property should be visible (true) or hidden (false).
-
isVisible
public boolean isVisible()Description copied from interface:VisiblePropertyChecks if this property is currently visible.- Specified by:
isVisiblein 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
PointSymbolTypeof 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 updatedPointSymbolinstance. 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
PointSymbolinstance 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
PointSymbolinstance 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 oftrueenables the animation, whilefalsedisables 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 thePointSymboland returns the updated instance.- Parameters:
offset- TheOffsetto be applied to thePointSymbol.- Returns:
- The updated
PointSymbolinstance with the specified offset applied.
-
getOffset
Retrieves the offset for the point symbol. If the offset does not already exist and thecreateIfNotExistsparameter istrue, a newOffsetinstance will be created.- Parameters:
createIfNotExists- A boolean flag indicating whether to create a newOffsetinstance if none exists. Iftrue, a new offset will be created when it does not exist; otherwise,nullwill be returned if it does not already exist.- Returns:
- The
Offsetinstance associated with the point symbol. May returnnullif no offset exists andcreateIfNotExistsisfalse.
-
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.
-