Package com.inet.report.chart.axis
Class BaseAxis
- java.lang.Object
-
- com.inet.report.chart.axis.BaseAxis
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ContinuousDateAxis
,DiscreteNumberAxis
,GroupAxis
public class BaseAxis extends java.lang.Object implements java.io.Serializable
Basic class for a chart axis. This class contains the basic properties and methods for chart axes.
To resolve which axis type is used by each chart style please see the set function of the chart plot according to your style. E.g.BarStyle
belongs to the plotBarPlot
. This uses aGroupAxis
as category axis (seeBarPlot.setCategoryAxis(GroupAxis)
) and aContinuousNumberAxis
as data axis (seeBarPlot.setDataAxis(ContinuousNumberAxis)
).- Since:
- 8.0
- See Also:
ContinuousAxis
,ContinuousDateAxis
,ContinuousNumberAxis
,DiscreteNumberAxis
,GroupAxis
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_AXIS_LINE_COLOR
The default axis color (the ABGR value representation).static int
DEFAULT_GRIDLINE_COLOR
The default grid lines color (the ABGR value representation).static int
DEFAULT_TICK_LABEL_COLOR
The default axis label color (the ABGR value representation).static java.awt.Font
DEFAULT_TICK_LABEL_FONT
The default axis tick labels font.static ChartTitle
DEFAULT_TITLE
Default title of this axis.static java.lang.String
TOKEN_CATEGORY_AXIS
XML token for a category axis element.static java.lang.String
TOKEN_DATA_AXIS
XML token for a data axis element.static java.lang.String
TOKEN_SERIES_AXIS
XML token for a series axis element.
-
Constructor Summary
Constructors Constructor Description BaseAxis()
Creates a instance of BaseAxis, sets the default properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyTo(BaseAxis that)
Copies the properties of this axis to the new axis.int
getAxisLineColor()
Returns the ABGR value representing the axis line color.AxisPosition
getAxisPosition()
Returns the relative position of this axis on the chart.int
getGridlineColor()
Returns the ABGR value representing the grid lines color.java.util.List<java.lang.Object>
getReferencedObjects()
Get FormulaFields referenced by this Axis.
Can be from marker (if this is MarkerAxis) or from title.protected java.lang.StringBuilder
getSubProperties(int depth)
Returns the serialized properties of subclasses.int
getTickLabelColor()
Returns the color as ABGR value of tick labels on this axis.java.awt.Font
getTickLabelFont()
Returns the font of tick labels on this axis.ChartFormat
getTickLabelFormat()
Returns a tick label format of this axis.ChartTitle
getTitle()
Gets the title of this axisboolean
isGridlinesVisible()
Returns whether or not the axis grid lines are visible.boolean
isInverseOrder()
Returns the orientation of the values on the axis.void
readProperties(org.w3c.dom.Element element, Chart2 chart)
Loads the XML properties of a chart axis.void
saveProperties(java.io.PrintWriter out, int depth, java.lang.String axisType)
Writes the axis properties to the output stream as XMLprotected void
saveSubProperties(java.io.PrintWriter out, int depth)
Writes the intern axis properties to output.void
setAxisLineColor(int axisLineColor)
Sets the ABGR components of the axis line color.void
setAxisPosition(AxisPosition position)
Sets the position of this axis on the chart or disables the axis from being shown, ifAxisPosition.NONE
is passed.void
setGridlineColor(int gridlineColor)
Sets the ABGR components of the grid lines color.void
setGridlinesVisible(boolean gridlinesVisible)
Sets whether or not the axis grid lines are visible.void
setInverseOrder(boolean inverseOrder)
Sets the orientation of the values on the axis -true if inverse, false otherwisevoid
setTickLabelColor(int tickLabelColor)
Sets the color as ABGR value of tick labels on this axis.void
setTickLabelFont(java.awt.Font tickLabelFont)
Sets the font of tick labels on this axis.void
setTickLabelFormat(ChartFormat tickLabelFormat)
Sets the tick label format.void
setTitle(ChartTitle title)
Sets the title of this axis.
-
-
-
Field Detail
-
DEFAULT_TICK_LABEL_COLOR
public static final int DEFAULT_TICK_LABEL_COLOR
The default axis label color (the ABGR value representation).- See Also:
- Constant Field Values
-
DEFAULT_TICK_LABEL_FONT
public static final java.awt.Font DEFAULT_TICK_LABEL_FONT
The default axis tick labels font.
-
DEFAULT_GRIDLINE_COLOR
public static final int DEFAULT_GRIDLINE_COLOR
The default grid lines color (the ABGR value representation).
-
DEFAULT_AXIS_LINE_COLOR
public static final int DEFAULT_AXIS_LINE_COLOR
The default axis color (the ABGR value representation).
-
DEFAULT_TITLE
public static final ChartTitle DEFAULT_TITLE
Default title of this axis.
-
TOKEN_CATEGORY_AXIS
public static final java.lang.String TOKEN_CATEGORY_AXIS
XML token for a category axis element.- See Also:
- Constant Field Values
-
TOKEN_SERIES_AXIS
public static final java.lang.String TOKEN_SERIES_AXIS
XML token for a series axis element.- See Also:
- Constant Field Values
-
TOKEN_DATA_AXIS
public static final java.lang.String TOKEN_DATA_AXIS
XML token for a data axis element.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BaseAxis
public BaseAxis()
Creates a instance of BaseAxis, sets the default properties. To disable the axis from being shown useAxisPosition.NONE
.- Since:
- 8.0
-
-
Method Detail
-
isGridlinesVisible
public boolean isGridlinesVisible()
Returns whether or not the axis grid lines are visible.- Returns:
- whether or not the axis grid lines are visible
- Since:
- 8.0
- See Also:
setGridlinesVisible(boolean)
-
setGridlinesVisible
public void setGridlinesVisible(boolean gridlinesVisible)
Sets whether or not the axis grid lines are visible.- Parameters:
gridlinesVisible
- whether or not the axis grid lines are visible- Since:
- 8.0
- See Also:
isGridlinesVisible()
-
getGridlineColor
public int getGridlineColor()
Returns the ABGR value representing the grid lines color.- Returns:
- the grid lines color.
- Since:
- 8.0
- See Also:
setGridlineColor(int)
,ColorUtils.toJavaColor(int)
-
setGridlineColor
public void setGridlineColor(int gridlineColor)
Sets the ABGR components of the grid lines color.- Parameters:
gridlineColor
- the color- Throws:
java.lang.IllegalArgumentException
- byRDC.COLOR_NO_COLOR
.- Since:
- 8.0
- See Also:
getGridlineColor()
,ColorUtils.toCcColor(Color)
,DEFAULT_GRIDLINE_COLOR
-
getAxisLineColor
public int getAxisLineColor()
Returns the ABGR value representing the axis line color.- Returns:
- the axis line color.
- Since:
- 8.0
- See Also:
setAxisLineColor(int)
,ColorUtils.toJavaColor(int)
-
isInverseOrder
public boolean isInverseOrder()
Returns the orientation of the values on the axis.- Returns:
- true if inverse order, false otherwise
- Since:
- 8.0
- See Also:
setInverseOrder(boolean)
-
setInverseOrder
public void setInverseOrder(boolean inverseOrder)
Sets the orientation of the values on the axis -true if inverse, false otherwise- Parameters:
inverseOrder
- the orientation of the values on the axis- Since:
- 8.0
- See Also:
isInverseOrder()
-
setAxisLineColor
public void setAxisLineColor(int axisLineColor)
Sets the ABGR components of the axis line color.- Parameters:
axisLineColor
- the color- Throws:
java.lang.IllegalArgumentException
- byRDC.COLOR_NO_COLOR
.- Since:
- 8.0
- See Also:
getAxisLineColor()
,ColorUtils.toCcColor(Color)
,DEFAULT_TICK_LABEL_COLOR
-
getTitle
public ChartTitle getTitle()
Gets the title of this axis- Returns:
- the axis title
- Since:
- 8.0
- See Also:
setTitle(ChartTitle)
-
setTitle
public void setTitle(ChartTitle title)
Sets the title of this axis. To disable the title use setAxisPosition(AxisPosition.NONE
)- Parameters:
title
- the axis title (null
not permitted)- Since:
- 8.0
- See Also:
getTitle()
,setAxisPosition(AxisPosition)
,AxisPosition.NONE
-
getTickLabelFont
public java.awt.Font getTickLabelFont()
Returns the font of tick labels on this axis.- Returns:
- the tick label font.
- Since:
- 8.0
- See Also:
setTickLabelFont(Font)
-
setTickLabelFont
public void setTickLabelFont(java.awt.Font tickLabelFont)
Sets the font of tick labels on this axis.- Parameters:
tickLabelFont
- the axis tick labels font (null
not permitted)- Since:
- 8.0
- See Also:
getTickLabelFont()
-
getTickLabelColor
public int getTickLabelColor()
Returns the color as ABGR value of tick labels on this axis.- Returns:
- the ABGR value representing the label color.
- Since:
- 8.0
- See Also:
setTickLabelColor(int)
,ColorUtils.toJavaColor(int)
-
setTickLabelColor
public void setTickLabelColor(int tickLabelColor)
Sets the color as ABGR value of tick labels on this axis.- Parameters:
tickLabelColor
- ABGR components of the axis labels color- Throws:
java.lang.IllegalArgumentException
- byRDC.COLOR_NO_COLOR
.- Since:
- 8.0
- See Also:
getTickLabelColor()
,ColorUtils.toCcColor(Color)
-
getTickLabelFormat
public ChartFormat getTickLabelFormat()
Returns a tick label format of this axis. The default value of this property isnull
, that means the chart formats the axis values automatically.- Returns:
- the format or
null
to auto format - Since:
- 8.0
- See Also:
setTickLabelFormat(ChartFormat)
-
setTickLabelFormat
public void setTickLabelFormat(ChartFormat tickLabelFormat)
Sets the tick label format. The default value of this property isnull
, that means the chart formats the axis values automatically. Note: for charts with number values on the axis, only formats extended fromNumberFormat
are allowed, and date charts, only formats extended fromDateFormat
are allowed.- Parameters:
tickLabelFormat
- the format (null
permitted)- Throws:
java.lang.IllegalArgumentException
- by date format for number values- Since:
- 8.0
- See Also:
getTickLabelFormat()
-
getAxisPosition
public AxisPosition getAxisPosition()
Returns the relative position of this axis on the chart. A y-axis with positionAxisPosition.ON_MIN
will be placed on the left side of chart.- Returns:
- the axis position
- Since:
- 8.0
- See Also:
setAxisPosition(AxisPosition)
,AxisPosition.ON_MIN
,AxisPosition.ON_MAX
,AxisPosition.NONE
-
setAxisPosition
public void setAxisPosition(AxisPosition position)
Sets the position of this axis on the chart or disables the axis from being shown, ifAxisPosition.NONE
is passed. A y-axis with positionAxisPosition.ON_MIN
will be placed on the left side of chart.- Parameters:
position
- the axis position (null
not permitted)- Throws:
java.lang.IllegalArgumentException
- if position isnull
.- Since:
- 8.0
- See Also:
getAxisPosition()
,AxisPosition.ON_MIN
,AxisPosition.ON_MAX
,AxisPosition.NONE
-
copyTo
public void copyTo(BaseAxis that)
Copies the properties of this axis to the new axis.- Parameters:
that
- the new axis to copy the properties to- Since:
- 8.0
-
saveProperties
public void saveProperties(java.io.PrintWriter out, int depth, java.lang.String axisType)
Writes the axis properties to the output stream as XML- Parameters:
out
- the output stream to write todepth
- the depth of whitespace indent to prefix each line withaxisType
- type of this axis: "category", "series" or "data"- Since:
- 8.0
-
getSubProperties
protected java.lang.StringBuilder getSubProperties(int depth)
Returns the serialized properties of subclasses.- Parameters:
depth
- the depth of XML indent- Returns:
- the properties.
- Since:
- 8.0
-
saveSubProperties
protected void saveSubProperties(java.io.PrintWriter out, int depth)
Writes the intern axis properties to output. Overwrites this to save intern properties direct toPrintWriter
without building aStringBuilder
.- Parameters:
out
- the outputdepth
- the depth of XML indent- Since:
- 8.0
-
readProperties
public void readProperties(org.w3c.dom.Element element, Chart2 chart)
Loads the XML properties of a chart axis.- Parameters:
element
- DOM element to read the properties fromchart
- the chart this axis belongs to- Since:
- 8.0
- See Also:
saveProperties(PrintWriter, int, String)
-
getReferencedObjects
public java.util.List<java.lang.Object> getReferencedObjects()
Get FormulaFields referenced by this Axis.
Can be from marker (if this is MarkerAxis) or from title.- Returns:
- a list with referenced fields, can be empty.
- Since:
- 11.2
-
-