com.davisor.graphics.chart
Class AxisAttributes

java.lang.Object
  extended bycom.davisor.graphics.chart.AxisAttributes
All Implemented Interfaces:
com.davisor.core.Dupable, java.io.Serializable
Direct Known Subclasses:
ChartAxes, ChartAxis

public class AxisAttributes
extends java.lang.Object
implements com.davisor.core.Dupable, java.io.Serializable

AxisAttributes represents chart coordinate axis attributes that may be shared among axes in the same axis group. These attributes are:

Render attributes control standard visual aspects of axis labels and title. Axis render attributes are managed by AxisRenderAttributes objects, that define two attribute sets, namely AXIS for axis attributes and TITLE for title attributes.

Label value type spesification gives formatting details for axis labels. The spesification is a text string, interpreted with the DataValue objects that at chart generation time carry information about axis minimum, maximum, and step values.

Gap gives a recommended percentage value of how much empty space should be left between elements rendered on this axis. Different chart factories interprete or ignore this value according to their nature.

Tic gives the axis tic mark shape used to visualize axis steps.

Tic mark level tells how many layers of tic marks are to be drawn on this axis. Many chart factories do not yet however support this feature very well.

Grid line stroke and color define the corresponding visual details of grid lines perpendicular to this axis. Grid lines may be turned off by leaving the stroke to null value, or with NullStroke.

Label rotation gives in radians the angle of how much axis labels are to be rotated around their center. Zero angle typically gives horizontal orientation. Positive angles typically rotate the labels to the counter-clockwise direction.

Title rotation controls title angle just like label rotation controls label angle.

Offset sets how much space must be leaved between the axis line and labels.

Opposite flag indicates if this axis should be rendered at the opposite side of coordinate area. Reverse flag indicates if the direction of this axis should be reversed. Silent flag indicates if axis labels should be suppressed.

Axis position string value sets the point where other axes should cross this one. Unlike most axis parameters, this setting therefore affects the placement and rendering of other axes. Some chart factories may also use this setting when deciding where certain visualization base levels lie. In the default case and with normal mathematical coordinates, axis position coincides with axis zero value. Possible other position values are min and max, and any data value axis DataValue objects recognized. See ChartAxis.computeValues(com.davisor.data.DataValue[]) for more information. Any of the attributes may be left unset, which instructs the receiving chart to use it's default settings. Different chart types may also interpret given attributes in different ways. Please see the documentation about the respective charts and attribute accessor methods for more information about the significance of each attribute.

Since:
JDK1.2
See Also:
AxisFactory, Type, Serialized Form

Field Summary
static java.lang.String AFTER_KEYWORD
          Axis after position keyword ("after").
static float AFTER_VALUE
          Axis after position value (2).
static java.lang.String BEFORE_KEYWORD
          Axis before position keyword ("before").
static float BEFORE_VALUE
          Axis before position value (-1).
protected  java.lang.Number M_gap
          Gap between axis elements (percents, may be null).
protected  java.lang.Boolean M_gridLines
          Enable or disable grid lines perpendicular to the axis (may be null).
protected  java.lang.String M_labelFormat
          Axis label value type specification (may be null).
protected  java.lang.Number M_labelOffset
          Axis label distance from axis.
protected  java.lang.Number M_labelRotation
          Axis label rotation (defaults to zero).
protected  java.lang.Integer M_level
          The number of tic mark levels (defaults to 1).
protected  java.lang.Float M_markerOffset
          Marker distance from labels.
protected  java.lang.Boolean M_opposite
          Axis side (may be null).
protected  java.lang.String M_positionStringValue
          Axis position (may be null).
protected  AxisRenderAttributes M_render
          Axis render attributes.
protected  java.lang.Boolean M_reversed
          Axis growth direction (may be null).
protected  java.lang.Boolean M_silent
          Suppress axis labels (may be null).
protected  java.awt.Shape M_tic
          Axis tic mark shape (may be null).
protected  java.lang.Float M_titleOffset
          Title distance from markers.
protected  java.lang.Number M_titleRotation
          Axis title rotation (defaults to zero).
static java.lang.String MAX_KEYWORD
          Axis max position keyword ("max").
static float MAX_VALUE
          Axis max position value (1).
static java.lang.String MIN_KEYWORD
          Axis min position keyword ("min").
static float MIN_VALUE
          Axis min position value (0).
 
Constructor Summary
AxisAttributes()
          Creates new axis attributes.
AxisAttributes(AxisAttributes aa)
          Deep copy constructor.
AxisAttributes(AxisRenderAttributes render, java.lang.String labelFormat, java.lang.Number gap, java.awt.Shape tic, java.lang.Integer level, java.lang.Boolean gridLines, java.lang.Float titleRotation, java.lang.Float titleOffset, java.lang.Float markerOffset, java.lang.Float labelRotation, java.lang.Number labelOffset, java.lang.Boolean opposite, java.lang.Boolean reversed, java.lang.Boolean silent, java.lang.String position)
          Creates a new axis attribute set.
 
Method Summary
 com.davisor.core.Dupable dup()
          Duplicates this object.
 boolean equals(java.lang.Object object)
          Test if this axis equals to given axis.
 java.lang.Number getGap()
          Gets axis gap.
 java.lang.String getLabelFormat()
          Gets axis label type spesification.
 java.lang.Number getLabelOffset()
          Gets axis label offset.
 float getLabelOffset(float defaultOffset)
          Gets axis label offset, or if unset, a given default offset value.
 float getLabelRotation()
          Gets label rotation in radians.
 java.lang.Integer getLevel()
          Gets axis tic recursion level.
 java.lang.Float getMarkerOffset()
          Gets axis marker offset.
 float getMarkerOffset(float defaultOffset)
          Gets axis marker offset, or if unset, a given default offset value.
 java.lang.String getPositionStringValue()
          Gets axis position string value.
 AxisRenderAttributes getRender()
          Gets axis render attributes.
 java.awt.Shape getTic()
          Gets axis tic mark.
 java.lang.Float getTitleOffset()
          Gets axis title offset.
 float getTitleOffset(float defaultOffset)
          Gets axis title offset, or if unset, a given default offset value.
 float getTitleRotation()
          Gets title rotation in radians.
 java.lang.Boolean hasGridLines()
          Tests if grid lines perpendicular to the axis are enabled.
 int hashCode()
          Gets axis attributes instance hash code.
 java.lang.Boolean isOpposite()
          Gets axis render side.
 boolean isOppositeDefault()
          Gets axis defaulted side.
 java.lang.Boolean isReversed()
          Gets axis growth direction.
 boolean isReversedDefault()
          Gets axis defaulted direction.
 java.lang.Boolean isSilent()
          Gets axis silency.
 boolean isSilentDefault()
          Gets axis defaulted silency.
 void setGap(float gap)
          Sets axis gap.
 void setGap(java.lang.Number gap)
          Sets axis gap.
 void setGridLines(boolean gridLines)
          Sets if grid lines perpendicular to the axis are enabled.
 void setGridLines(java.lang.Boolean gridLines)
          Sets if grid lines perpendicular to the axis are enabled.
 void setLabelFormat(java.lang.String labelFormat)
          Sets the axis label value type specification.
 void setLabelOffset(float labelOffset)
          Sets axis label offset.
 void setLabelOffset(java.lang.Number labelOffset)
          Sets axis label offset.
 void setLabelRotation(float labelRotation)
          Sets the label rotation.
 void setLabelRotation(java.lang.Number labelRotation)
          Sets the label rotation.
 void setLevel(java.lang.Integer level)
          Sets the axis tic recursion level.
 void setMarkerOffset(float markerOffset)
          Sets axis marker offset.
 void setMarkerOffset(java.lang.Float markerOffset)
          Sets axis marker offset.
 void setOpposite(boolean opposite)
          Sets axis rendering side.
 void setOpposite(java.lang.Boolean opposite)
          Sets axis rendering opposite.
 void setPositionStringValue(java.lang.String position)
          Sets axis position string value.
 void setRender(AxisRenderAttributes render)
          Sets axis render attributes.
 void setReversed(boolean reversed)
          Sets axis growth direction.
 void setReversed(java.lang.Boolean reversed)
          Sets axis growth direction.
 void setSilent(boolean silent)
          Sets axis growth direction.
 void setSilent(java.lang.Boolean silent)
          Sets axis silency.
 void setTic(java.awt.Shape tic)
          Sets the axis tic mark.
 void setTitleOffset(float titleOffset)
          Sets axis title offset.
 void setTitleOffset(java.lang.Float titleOffset)
          Sets axis title offset.
 void setTitleRotation(float titleRotation)
          Sets the title rotation.
 void setTitleRotation(java.lang.Number titleRotation)
          Sets the title rotation.
 java.lang.String toString()
          Gets rendering attributes XML representation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AFTER_KEYWORD

public static final java.lang.String AFTER_KEYWORD
Axis after position keyword ("after").

See Also:
Constant Field Values

AFTER_VALUE

public static final float AFTER_VALUE
Axis after position value (2).

See Also:
Constant Field Values

BEFORE_KEYWORD

public static final java.lang.String BEFORE_KEYWORD
Axis before position keyword ("before").

See Also:
Constant Field Values

BEFORE_VALUE

public static final float BEFORE_VALUE
Axis before position value (-1).

See Also:
Constant Field Values

MAX_KEYWORD

public static final java.lang.String MAX_KEYWORD
Axis max position keyword ("max").

See Also:
Constant Field Values

MAX_VALUE

public static final float MAX_VALUE
Axis max position value (1).

See Also:
Constant Field Values

MIN_KEYWORD

public static final java.lang.String MIN_KEYWORD
Axis min position keyword ("min").

See Also:
Constant Field Values

MIN_VALUE

public static final float MIN_VALUE
Axis min position value (0).

See Also:
Constant Field Values

M_gap

protected java.lang.Number M_gap
Gap between axis elements (percents, may be null).


M_gridLines

protected java.lang.Boolean M_gridLines
Enable or disable grid lines perpendicular to the axis (may be null).


M_labelFormat

protected java.lang.String M_labelFormat
Axis label value type specification (may be null).


M_labelOffset

protected java.lang.Number M_labelOffset
Axis label distance from axis.


M_labelRotation

protected java.lang.Number M_labelRotation
Axis label rotation (defaults to zero).


M_level

protected java.lang.Integer M_level
The number of tic mark levels (defaults to 1).


M_render

protected AxisRenderAttributes M_render
Axis render attributes.


M_opposite

protected java.lang.Boolean M_opposite
Axis side (may be null).


M_positionStringValue

protected java.lang.String M_positionStringValue
Axis position (may be null).


M_reversed

protected java.lang.Boolean M_reversed
Axis growth direction (may be null).


M_silent

protected java.lang.Boolean M_silent
Suppress axis labels (may be null).


M_tic

protected java.awt.Shape M_tic
Axis tic mark shape (may be null).


M_titleOffset

protected java.lang.Float M_titleOffset
Title distance from markers.


M_markerOffset

protected java.lang.Float M_markerOffset
Marker distance from labels.


M_titleRotation

protected java.lang.Number M_titleRotation
Axis title rotation (defaults to zero).

Constructor Detail

AxisAttributes

public AxisAttributes()
Creates new axis attributes.


AxisAttributes

public AxisAttributes(AxisAttributes aa)
Deep copy constructor.

See Also:
dup()

AxisAttributes

public AxisAttributes(AxisRenderAttributes render,
                      java.lang.String labelFormat,
                      java.lang.Number gap,
                      java.awt.Shape tic,
                      java.lang.Integer level,
                      java.lang.Boolean gridLines,
                      java.lang.Float titleRotation,
                      java.lang.Float titleOffset,
                      java.lang.Float markerOffset,
                      java.lang.Float labelRotation,
                      java.lang.Number labelOffset,
                      java.lang.Boolean opposite,
                      java.lang.Boolean reversed,
                      java.lang.Boolean silent,
                      java.lang.String position)
Creates a new axis attribute set.

Parameters:
render - render attributes (may be null)
labelFormat - label type specification (may be null)
gap - gap (percents, may be null)
tic - tic mark shape (may be null)
level - tic mark recursion level
gridLines - enable or disable grid lines (may be null)
titleRotation - title rotation (may be null)
titleOffset - title offset (may be null)
markerOffset - marker offset (may be null)
labelRotation - label rotation (may be null)
labelOffset - label offset (may be null)
opposite - axis side (may be null)
reversed - axis growth direction (may be null)
silent - suppress axis labels (may be null)
position - axis position (may be null)
See Also:
Type
Method Detail

dup

public com.davisor.core.Dupable dup()
Duplicates this object.

Specified by:
dup in interface com.davisor.core.Dupable

equals

public boolean equals(java.lang.Object object)
Test if this axis equals to given axis.


hashCode

public int hashCode()
Gets axis attributes instance hash code.


toString

public java.lang.String toString()
Gets rendering attributes XML representation.

See Also:
toString(), Strings.toXML(String,Object)

getGap

public java.lang.Number getGap()
Gets axis gap.

See Also:
setGap(float), setGap(Number)

getLabelOffset

public java.lang.Number getLabelOffset()
Gets axis label offset.

See Also:
getLabelOffset(float), setLabelOffset(Number)

getLabelOffset

public float getLabelOffset(float defaultOffset)
Gets axis label offset, or if unset, a given default offset value.

Parameters:
defaultOffset - default offset to be used if offset has not been set
See Also:
getLabelOffset(), setLabelOffset(float)

getLabelRotation

public float getLabelRotation()
Gets label rotation in radians. If rotation value is currently unset, rotation defaults to 0, indicating horizontal positive direction. Positive values turn the labels counter-clockwise.

Use Units to convert the angle value to other angle units.

See Also:
setLabelRotation(float), setLabelRotation(Number), Units

getLevel

public java.lang.Integer getLevel()
Gets axis tic recursion level.

See Also:
setLevel(java.lang.Integer)

getPositionStringValue

public java.lang.String getPositionStringValue()
Gets axis position string value.

See Also:
setPositionStringValue(java.lang.String), ChartAxis.getPosition()

getRender

public AxisRenderAttributes getRender()
Gets axis render attributes.

See Also:
setRender(com.davisor.graphics.chart.AxisRenderAttributes)

getLabelFormat

public java.lang.String getLabelFormat()
Gets axis label type spesification. If the spesification has not been set, the default locale string is returned.

See Also:
setLabelFormat(java.lang.String)

getMarkerOffset

public java.lang.Float getMarkerOffset()
Gets axis marker offset.

See Also:
getMarkerOffset(float), setMarkerOffset(float)

getMarkerOffset

public float getMarkerOffset(float defaultOffset)
Gets axis marker offset, or if unset, a given default offset value.

Parameters:
defaultOffset - default offset to be used if offset has not been set
See Also:
getMarkerOffset(), setMarkerOffset(float)

getTic

public java.awt.Shape getTic()
Gets axis tic mark. If not explicitly given, the tic marks default to chart factory default tic shape.

See Also:
setTic(java.awt.Shape)

getTitleOffset

public java.lang.Float getTitleOffset()
Gets axis title offset.

See Also:
getTitleOffset(float), setTitleOffset(float)

getTitleOffset

public float getTitleOffset(float defaultOffset)
Gets axis title offset, or if unset, a given default offset value.

Parameters:
defaultOffset - default offset to be used if offset has not been set
See Also:
getTitleOffset(), setTitleOffset(float)

getTitleRotation

public float getTitleRotation()
Gets title rotation in radians. If rotation value is currently unset, rotation defaults to 0, indicating horizontal positive direction. Positive values turn the title counter-clockwise.

Use Units to convert the angle value to other angle units.

See Also:
setTitleRotation(float), setTitleRotation(Number), Units

hasGridLines

public java.lang.Boolean hasGridLines()
Tests if grid lines perpendicular to the axis are enabled.

See Also:
setGridLines(boolean), setGridLines(Boolean)

isOpposite

public java.lang.Boolean isOpposite()
Gets axis render side.

Returns:
axis side (may be null)
See Also:
setOpposite(boolean), setOpposite(Boolean)

isOppositeDefault

public boolean isOppositeDefault()
Gets axis defaulted side. If axis side is undetermined, false is returned.

See Also:
isOpposite()

isReversed

public java.lang.Boolean isReversed()
Gets axis growth direction.

Returns:
axis direction (may be null)
See Also:
setReversed(boolean), setReversed(Boolean)

isReversedDefault

public boolean isReversedDefault()
Gets axis defaulted direction. If axis direction is undetermined, false is returned.

See Also:
isReversed()

isSilent

public java.lang.Boolean isSilent()
Gets axis silency. Silent axis will not display labels.

Returns:
axis silence status (may be null)
See Also:
setSilent(boolean), setSilent(Boolean)

isSilentDefault

public boolean isSilentDefault()
Gets axis defaulted silency. If axis silency is undetermined, false is returned.

See Also:
isSilent()

setReversed

public void setReversed(boolean reversed)
Sets axis growth direction.

See Also:
isReversed(), setReversed(Boolean)

setReversed

public void setReversed(java.lang.Boolean reversed)
Sets axis growth direction.

See Also:
isReversed(), setReversed(boolean)

setSilent

public void setSilent(boolean silent)
Sets axis growth direction.

See Also:
isSilent(), setSilent(Boolean)

setSilent

public void setSilent(java.lang.Boolean silent)
Sets axis silency.

See Also:
isSilent(), setSilent(boolean)

setGap

public void setGap(float gap)
Sets axis gap.

See Also:
getGap(), setGap(Number)

setGap

public void setGap(java.lang.Number gap)
Sets axis gap. Axis gap, if set, determines a proportional gap between the chart visual elements. A zero gap value lays elements next to each other, while value one moves the elements as far from each other as possible. null selects the chart default behaviour.

See Also:
getGap(), setGap(float)

setGridLines

public void setGridLines(boolean gridLines)
Sets if grid lines perpendicular to the axis are enabled.

See Also:
hasGridLines(), setGridLines(Boolean)

setGridLines

public void setGridLines(java.lang.Boolean gridLines)
Sets if grid lines perpendicular to the axis are enabled.

See Also:
hasGridLines(), setGridLines(boolean)

setLabelOffset

public void setLabelOffset(float labelOffset)
Sets axis label offset.

See Also:
getLabelOffset(), getLabelOffset(float), setLabelOffset(Number)

setLabelOffset

public void setLabelOffset(java.lang.Number labelOffset)
Sets axis label offset. The label offset determines the empty space between the axis and the axis labels. If it is null, it defaults to some appropriate value, like zero, font leading, or 50% of the font size.

See Also:
getLabelOffset(), getLabelOffset(float), setLabelOffset(float)

setLabelRotation

public void setLabelRotation(float labelRotation)
Sets the label rotation. The rotation determines the tilt angle of the axis labels, expressed in radians. The default orientation of all labels is horizontal. Positive values turn the labels counter-clockwise.

Use Units to convert the angle value to other angle units.

Parameters:
labelRotation - label tilt angle
See Also:
getLabelRotation(), setLabelRotation(Number), Units

setLabelRotation

public void setLabelRotation(java.lang.Number labelRotation)
Sets the label rotation. The rotation determines the tilt angle of the axis labels, expressed in radians. The default orientation of all labels is horizontal. Positive values turn the labels counter-clockwise.

Use Units to convert the angle value to other angle units.

Parameters:
labelRotation - label tilt angle (may be null)
See Also:
getLabelRotation(), setLabelRotation(float), Units

setLevel

public void setLevel(java.lang.Integer level)
Sets the axis tic recursion level. The default level is one, which produces one set of top-level tic marks. Each higher level produces additional intermediate tic marks between the previous level tic marks. Negative and zero levels turn tic marks off for this axis.

See Also:
getLevel()

setRender

public void setRender(AxisRenderAttributes render)
Sets axis render attributes.

See Also:
getRender()

setOpposite

public void setOpposite(boolean opposite)
Sets axis rendering side.

See Also:
isOpposite(), setOpposite(Boolean)

setOpposite

public void setOpposite(java.lang.Boolean opposite)
Sets axis rendering opposite.

See Also:
isOpposite(), setOpposite(boolean)

setPositionStringValue

public void setPositionStringValue(java.lang.String position)
Sets axis position string value. Axis position tells the position along this axis where other axes will cross it.

Axis position string value may be a data string value, expressed as the values that are laid on this axis, or one of the position string keywords:

Please see ChartAxis.computePosition() for description of how position string value is eventually interpreted, and actual position value computed. Please note also, that the actual position value is computed in that method, while the position string value is just a simple data type intependent manner way to bring in position information from user interface.

See Also:
getPositionStringValue(), setPositionStringValue(java.lang.String)

setLabelFormat

public void setLabelFormat(java.lang.String labelFormat)
Sets the axis label value type specification. The specification, if given, will finetune the axis type definition, typically affecting the details about how axis type values are interpreted and displayed as text. In particular, this affects the axis minimum, maximum and also the step value interpretation.

The axis type is automatically determined from the data that will be laid along this axis. Acceptable specification string formats vary between different data types, so prior knowledge of the nature of the expected axis data is necessary. Invalid specification strings may produce unexpected value rendering results.

Parameters:
labelFormat - axis label value type specification
See Also:
getLabelFormat(), Type

setMarkerOffset

public void setMarkerOffset(float markerOffset)
Sets axis marker offset.

See Also:
getMarkerOffset(), getMarkerOffset(float), setMarkerOffset(Float)

setMarkerOffset

public void setMarkerOffset(java.lang.Float markerOffset)
Sets axis marker offset. The marker offset determines the empty space between the axis marker and labels. If it is null, it defaults to some appropriate value.

See Also:
getMarkerOffset(), getMarkerOffset(float), setMarkerOffset(float)

setTic

public void setTic(java.awt.Shape tic)
Sets the axis tic mark. The tic mark shape is used to draw axis scale tic marks.

See Also:
getTic()

setTitleOffset

public void setTitleOffset(float titleOffset)
Sets axis title offset.

See Also:
getTitleOffset(), getTitleOffset(float), setTitleOffset(Float)

setTitleOffset

public void setTitleOffset(java.lang.Float titleOffset)
Sets axis title offset. The title offset determines the empty space between the axis title and markers. If it is null, it defaults to some appropriate value.

See Also:
getTitleOffset(), getTitleOffset(float), setTitleOffset(float)

setTitleRotation

public void setTitleRotation(float titleRotation)
Sets the title rotation. The rotation determines the tilt angle of the axis title, expressed in radians. The default orientation of all titles is horizontal. Positive values turn a title counter-clockwise.

Use Units to convert the angle value to other angle units.

Parameters:
titleRotation - title tilt angle
See Also:
getTitleRotation(), setTitleRotation(Number), Units

setTitleRotation

public void setTitleRotation(java.lang.Number titleRotation)
Sets the title rotation. The rotation determines the tilt angle of the axis title, expressed in radians. The default orientation of all titles is horizontal. Positive values turn the title counter-clockwise.

Use Units to convert the angle value to other angle units.

Parameters:
titleRotation - title tilt angle (may be null)
See Also:
getTitleRotation(), setTitleRotation(float), Units


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.