Package com.storedobject.chart
Class Axis
java.lang.Object
com.storedobject.chart.AbstractPart
com.storedobject.chart.VisiblePart
com.storedobject.chart.Axis
- All Implemented Interfaces:
ComponentPart,ComponentProperty,VisibleProperty,Wrapped
- Direct Known Subclasses:
AngleAxis,RadarAxis,RadiusAxis,XYAxis
Abstract representation of an axis.
- Author:
- Syam
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents ticks on an axis line.static classRepresents the grid-areas drawn by the axis.static classRepresents the grid-lines drawn by the axis.static classRepresents the label used byAxis.static classA base class for various types of lines used in axis and coordinate systems.static classRepresents the minor grid-lines drawn by the axis.static classRepresents the minor tick on the axis line.static classRepresents the axis-pointer shown by the axis.static classRepresent the handle that can be used with an axis-pointer.static classRepresents the label displayed by the axis-pointer.static enumDefinition of pointer types.static classRepresents the tick on the axis line. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEncode the JSON string with the properties of this.booleanGet the data type of this axis.final Axis.GridAreasgetGridAreas(boolean create) Get the grid-areas for the axis.final Axis.GridLinesgetGridLines(boolean create) Get the grid-lines of the axis.final Axis.LabelgetLabel(boolean create) Get the label.final Axis.MinorGridLinesgetMinorGridLines(boolean create) Get the minor grid-lines of the axis.final Axis.MinorTicksgetMinorTicks(boolean create) Get the minor tick of the axis-line.final StringgetName()Get the name of the axis.intGet the gap between the axis and the name in pixels.Get the location of the name.intGet the rotation of the name in degrees.final TextStylegetNameTextStyle(boolean create) Get the text style for the name.final Axis.PointergetPointer(boolean create) Get the axis-pointer for the axis.intReturn the rendering index of this part.final Axis.TicksgetTicks(boolean create) Get the axis-line ticks.inthashCode()voidinvert()Invert the axis.booleanDetermines whether events are allowed on this axis.voidsetAllowEvents(boolean allowEvents) Sets whether events are allowed on this axis.voidsetData(AbstractDataProvider<?> data) Set the data for this axis.voidsetDivisions(int divisions) Set the number of divisions on the axis.voidsetGridAreas(Axis.GridAreas gridAreas) Set the grid-areas for the axis.voidsetGridLines(Axis.GridLines gridLines) Set the grid-lines for the axis.voidsetLabel(Axis.Label label) Set the label for the axis.voidSet the maximum value for the axis.voidBy invoking this method, the maximum of the axis will be set as the maximum value of the data.voidSet the minimum value for the axis.voidBy invoking this method, the minimum of the axis will be set as the minimum value of the data.voidsetMinorGridLines(Axis.MinorGridLines gridLines) Set the minor grid-lines for the axis.voidsetMinorTicks(Axis.MinorTicks ticks) Set the minor of the axis-line.voidSet the name of the axis.voidsetNameGap(int nameGap) Set the gap between the axis and the name in pixels.voidsetNameLocation(Location nameLocation) Set the location of the name.voidsetNameRotation(int nameRotation) Set the rotation of the name in degrees.voidsetNameTextStyle(TextStyle nameTextStyle) Set the text style or the name.voidsetPointer(Axis.Pointer pointer) Set the axis-pointer for this axis.voidsetRenderingIndex(int renderingIndex) Set the rendering index of this part.voidsetTicks(Axis.Ticks ticks) Set the axis-line ticks.voidshowZeroPosition(boolean show) Set whether zero positions to be shown or not.voidvalidate()This method is invoked bySOChartto check if the component or part is valid or not.Methods inherited from class com.storedobject.chart.VisiblePart
isVisible, setVisibleMethods inherited from class com.storedobject.chart.AbstractPart
getId, getLabelTag, getSerial, getZ, hasId, setSerial, setZMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.storedobject.chart.ComponentPart
classNameMethods inherited from interface com.storedobject.chart.VisibleProperty
hide, show
-
Constructor Details
-
Axis
-
Axis
Constructor.- Parameters:
data- Data type will be determined from the data provider.
-
-
Method Details
-
equals
- Overrides:
equalsin classAbstractPart
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractPart
-
validate
Description copied from interface:ComponentPartThis method is invoked bySOChartto check if the component or part is valid or not.- Specified by:
validatein interfaceComponentPart- Overrides:
validatein classVisiblePart- Throws:
ChartException- Raises exception if the component or part is not valid.
-
setData
Set the data for this axis.Note: Normally, this is not required to be set unless you are working on a custom chart that is not yet supported.
- Parameters:
data- Data to be used for this axis.
-
encodeJSON
Description copied from interface:ComponentPropertyEncode the JSON string with the properties of this.- Specified by:
encodeJSONin interfaceComponentProperty- Overrides:
encodeJSONin classAbstractPart- Parameters:
sb- Encoded JSON string to be appended to this.
-
setAllowEvents
public void setAllowEvents(boolean allowEvents) Sets whether events are allowed on this axis.- Parameters:
allowEvents- True to allow events, false to disable them.
-
isAllowEvents
public boolean isAllowEvents()Determines whether events are allowed on this axis.- Returns:
- True if events are allowed, false otherwise.
-
setRenderingIndex
public void setRenderingIndex(int renderingIndex) Description copied from interface:ComponentPartSet the rendering index of this part. Rendering index is the position of this part on the chart when it is being rendered. It is up to the part to keep this value if required.- Specified by:
setRenderingIndexin interfaceComponentPart- Parameters:
renderingIndex- Rendering index.
-
getRenderingIndex
public int getRenderingIndex()Description copied from interface:ComponentPartReturn the rendering index of this part. The default implementation returns -1.- Specified by:
getRenderingIndexin interfaceComponentPart- Returns:
- Rendering index.
-
getName
Get the name of the axis.- Specified by:
getNamein interfaceComponentPart- Overrides:
getNamein classAbstractPart- Returns:
- Name of the axis.
-
setName
Set the name of the axis.- Specified by:
setNamein interfaceComponentPart- Parameters:
name- Name to set.
-
invert
public void invert()Invert the axis. If called, the drawing of the axis will be inverted (drawn in the opposite direction). -
getNameGap
public int getNameGap()Get the gap between the axis and the name in pixels. (It can have negative values).- Returns:
- Gap in pixels.
-
setNameGap
public void setNameGap(int nameGap) Set the gap between the axis and the name in pixels. (It can have negative values).- Parameters:
nameGap- Gap in pixels.
-
getNameRotation
public int getNameRotation()Get the rotation of the name in degrees.- Returns:
- Rotation.
-
setNameRotation
public void setNameRotation(int nameRotation) Set the rotation of the name in degrees.- Parameters:
nameRotation- Rotation.
-
getNameLocation
-
setNameLocation
Set the location of the name.- Parameters:
nameLocation- Location to set.
-
getNameTextStyle
Get the text style for the name.- Parameters:
create- Whether to create if not exists or not.- Returns:
- Text style.
-
setNameTextStyle
Set the text style or the name.- Parameters:
nameTextStyle- Text style to set.
-
setMin
Set the minimum value for the axis.- Parameters:
min- Minimum value. (For category axis, it could be just an ordinal number of the categories). Note: The type of the value must be compatible with the data type of the axis. Otherwise, it will be ignored.
-
setMinAsMinData
public void setMinAsMinData()By invoking this method, the minimum of the axis will be set as the minimum value of the data. -
setMax
Set the maximum value for the axis.- Parameters:
max- Maximum value. (For category axis, it could be just an ordinal number of the categories). Note: The type of the value must be compatible with the data type of the axis. Otherwise, it will be ignored.
-
setMaxAsMaxData
public void setMaxAsMaxData()By invoking this method, the maximum of the axis will be set as the maximum value of the data. -
setDivisions
public void setDivisions(int divisions) Set the number of divisions on the axis. This will be used as a hint only because for actual divisions will be determined based on the readability too. Also, this is not applicable to category type axes.- Parameters:
divisions- Number of divisions.
-
showZeroPosition
public void showZeroPosition(boolean show) Set whether zero positions to be shown or not. On certain charts, it may be required not to show zero positions of the axis. Note: this setting is ignored if minimum and maximum values are already set. Also, this is not applicable to category type axes.- Parameters:
show- True or false.
-
getLabel
Get the label.- Parameters:
create- Whether to create if not exists or not.- Returns:
- Label.
-
setLabel
-
getTicks
Get the axis-line ticks.- Parameters:
create- Whether to create if not exists or not.- Returns:
- Tick.
-
setTicks
-
getMinorTicks
Get the minor tick of the axis-line.- Parameters:
create- Whether to create if not exists or not.- Returns:
- Minor ticks.
-
setMinorTicks
Set the minor of the axis-line.- Parameters:
ticks- Minor ticks.
-
getGridLines
Get the grid-lines of the axis.- Parameters:
create- Whether to create if not exists or not.- Returns:
- Grid-lines.
-
setGridLines
Set the grid-lines for the axis.- Parameters:
gridLines- Grid-lines to set.
-
getMinorGridLines
Get the minor grid-lines of the axis.- Parameters:
create- Whether to create if not exists or not.- Returns:
- Grid-lines.
-
setMinorGridLines
Set the minor grid-lines for the axis.- Parameters:
gridLines- Grid-lines to set.
-
getGridAreas
Get the grid-areas for the axis.- Parameters:
create- Whether to create if not exists or not.- Returns:
- Grid-areas.
-
setGridAreas
Set the grid-areas for the axis.- Parameters:
gridAreas- Grid-areas to set.
-
getPointer
Get the axis-pointer for the axis. (By default, no axis-pointer will be shown. However, if a call is made to this method withcreate = true, an axis-pointer will be made visible. Then, you may use theVisibleProperty.hide()method to hide it if required.)- Parameters:
create- Whether to create if not exists or not.- Returns:
- Axis-pointer.
-
setPointer
Set the axis-pointer for this axis.- Parameters:
pointer- Axis-pointer.
-
getDataType
-