com.ijchart.xychart.axis
Class AbstractAxis

java.lang.Object
  extended by com.ijchart.xychart.axis.AbstractAxis
All Implemented Interfaces:
IAxis, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AbstractValueAxis, CategoryAxis

public abstract class AbstractAxis
extends java.lang.Object
implements IAxis, java.lang.Cloneable, java.io.Serializable

Title: IJChart

Description: a chart library for the Java(tm) platform.

The base class for all axes in IJChart.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
static java.awt.Paint DEFAULT_3D_AXIS_FILL_PAINT
           The default paint used for fill 3d axis.
static boolean DEFAULT_AUTO_SELECT_TICK_LABEL_ALIGN
           The default auto selec label alignment value.
static java.awt.Font DEFAULT_AXIS_LABEL_FONT
           The default axis label font.
static RectangleInsets DEFAULT_AXIS_LABEL_INSETS
           The default axis label insets.
static java.awt.Paint DEFAULT_AXIS_LABEL_PAINT
           The default axis label paint.
static AxisLabelType DEFAULT_AXIS_LABEL_TYPE
           The default axis label type.
static boolean DEFAULT_AXIS_LABEL_VISIBLE
           The default axis label visible.
static java.awt.Paint DEFAULT_AXIS_LINE_PAINT
           The default axis line paint.
static java.awt.Stroke DEFAULT_AXIS_LINE_STROKE
           The default axis line stroke.
static boolean DEFAULT_AXIS_LINE_VISIBLE
           A default flag that controls whether or not the axis line is visible.
static double DEFAULT_AXIS_MARGIN
           The default margin for the axis (used for both lower and upper margins).
static boolean DEFAULT_AXIS_VISIBLE
           The default axis visibility.
static boolean DEFAULT_DRAW_EMPTY_LABEL_TICK_MARK
           A default flag the controls whether or not draw tick mark with empty label.
static double DEFAULT_FIXED_AXIS_SPACE
           The default fixed axis space.
static boolean DEFAULT_GRID_LINE_VISIBLE
           A default flag indicate whether or not grid line is visible.
static HorizontalAlignment DEFAULT_LABEL_HORIZONTAL_ALIGNMENT
           The default label horizontal alignment.
static float DEFAULT_MAXIMUM_CATEGORY_LABEL_WIDTH_RATIO
           The default ratio that is multiplied by the width of one category to determine the maximum label width.
static java.awt.Font DEFAULT_TICK_LABEL_FONT
           The default tick label font.
static HorizontalAlignment DEFAULT_TICK_LABEL_HORIZONTAL_ALIGNMENT
           The default tick label horizontal alignment.
static RectangleInsets DEFAULT_TICK_LABEL_INSETS
           The default tick label insets.
static java.awt.Paint DEFAULT_TICK_LABEL_PAINT
           The default tick label paint.
static VerticalAlignment DEFAULT_TICK_LABEL_VERTICAL_ALIGNMENT
           The default tick label vertical alignment.
static boolean DEFAULT_TICK_LABELS_VISIBLE
           The default tick labels visibility.
static float DEFAULT_TICK_MARK_INSIDE_LENGTH
           The default tick mark inside length.
static float DEFAULT_TICK_MARK_OUTSIDE_LENGTH
           The default tick mark outside length.
static java.awt.Paint DEFAULT_TICK_MARK_PAINT
           The default tick paint.
static java.awt.Stroke DEFAULT_TICK_MARK_STROKE
           The default tick stroke.
static boolean DEFAULT_TICK_MARKS_VISIBLE
           The default tick marks visible.
static double WIDTH_TICK_MARK_AND_TICK_LABEL
           The space width between tick mark and tick label.
 
Constructor Summary
protected AbstractAxis(IMatrixDataset dataset)
           Constructs an axis using a dataset.
protected AbstractAxis(java.lang.String label, IMatrixDataset dataset)
           Constructs an axis using label and a dataset.
 
Method Summary
 void addChangeListener(IAxisChangeListener listener)
           Registers an object for notification of changes to the axis.
 double calculateAxisSpace(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D maxAxisArea, RectangleEdge edge)
           Calculation the width or height of painting coordinate axis.
protected  java.awt.geom.Rectangle2D calculateLabelBound(java.awt.Graphics2D g2, double labelMaxWidth, double labelMaxHeight, double labelAngle, RectangleEdge edge, java.lang.String[] seriesLabel, java.awt.Font labelFont, RectangleInsets inset)
           Calculate the bound of draw a label.
 java.lang.Object clone()
           Returns a clone of the axis.
protected  IChartShape createAxisLabelChartShape(java.awt.geom.Rectangle2D axisLabelDrawRect)
           Create a RectangleTextChartShape object.
protected  double dawAxisLabel(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D axisArea, RectangleEdge edge, AxisShapeCollection shapeCollection, double cursor)
           Draw the axis label.
 double draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D axisArea, RectangleEdge edge, AxisShapeCollection shapeCollection, boolean alignEdge)
           Draw the X-axis or Y-axis on plot area(plotArea).All axis shape is stored in shapeCollection.
protected  double drawAxis3DLine(IEffect3D effect3D, java.awt.geom.Rectangle2D axisArea, RectangleEdge edge, AxisShapeCollection shapeCollection)
           Draws an axis line in a specified area and edge.
protected  double drawAxisLine(java.awt.geom.Rectangle2D axisArea, RectangleEdge edge, AxisShapeCollection shapeCollection)
           Draws an axis line in a specified area and edge.
abstract  void drawGridLine(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, RectangleEdge axisEdge, RenderShapeCollection shapeCollection, java.awt.Stroke stroke, java.awt.Paint paint)
           Draw the grid line,only call after IAxis.draw().
protected abstract  double drawTickLabel(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D axisArea, RectangleEdge edge, AxisShapeCollection shapeCollection, double cursor)
           Draws tick mark labels in a specified area and edge.
protected abstract  double drawTickMark(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D axisArea, RectangleEdge edge, AxisShapeCollection shapeCollection, double cursor)
           Draws tick marks in a specified area and edge.
 boolean equals(java.lang.Object obj)
           Tests this axis for equality with another object.
protected  void fireAxisChanged()
           Notifies all registered listeners that the axis has changed.
 java.awt.Paint getAxis3DFillPaint()
           Returns the paint used for fill 3d axis.
 java.lang.String getAxisLabel()
           Returns the label for the axis.
 double getAxisLabelAngle()
           Returns the angle of the axis label.
 java.awt.Font getAxisLabelFont()
           Returns the font for the axis label.
 HorizontalAlignment getAxisLabelHorizontalAlign()
           Returns the label horizontal alignment.
 RectangleInsets getAxisLabelInsets()
           Returns the insets for the label (that is, the amount of blank space that should be left around the label).
 java.awt.Paint getAxisLabelPaint()
           Returns the color/shade used to draw the axis label.
 AxisLabelType getAxisLabelType()
           Returns the axis label type.
 java.awt.Paint getAxisLinePaint()
           Returns the paint used to draw the axis line.
 java.awt.Stroke getAxisLineStroke()
           Returns the stroke used to draw the axis line.
 IFormatter getColKeyFormatter()
           Returns the formatter for format the colKeys in dataset.
 IFormatter getDataFormatter()
           Returns the formatter for format the data in dataset.
 IMatrixDataset getDataset()
           Return the dataset.
 double getFixedAxisSpace()
           Returns the fixed axis space.
protected abstract  java.lang.String[] getFormatedTickLabels(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D maxAxisArea, RectangleEdge edge)
           Returns the formated tick labels.
 double getLowerMargin()
           Returns the lower margin for the axis.
 float getMaximumCategoryLabelWidthRatio()
           Returns the category label width ratio.
 IFormatter getRowKeyFormatter()
           Returns the formatter for format the rowKeys in dataset.
 double getTickLabelAngle()
           Returns the tick label angle (in radians).
 java.awt.Font getTickLabelFont()
           Returns the font used for the tick labels (if showing).
 java.awt.Font getTickLabelFont(java.lang.Object tickLabel)
           Returns the font used for the specified tick label (if showing).
 HorizontalAlignment getTickLabelHorizontalAlign()
           Returns the tick label horizontal alignment.
 RectangleInsets getTickLabelInsets()
           Returns the insets for the tick labels.
protected  int getTickLabelLines()
           Returns the line count of tick labels.
 java.awt.Paint getTickLabelPaint()
           Returns the color/shade used for the tick labels.
 java.awt.Paint getTickLabelPaint(java.lang.Object tickLabel)
           Returns the color/shade used for the tick labels.
protected  java.awt.geom.Rectangle2D getTickLabelRotateBound(java.awt.geom.Rectangle2D rect, double angle)
           Returns the rotate bound of tick label bound.
 VerticalAlignment getTickLabelVerticalAlign()
           Returns the tick label vertical alignment.
 float getTickMarkInsideLength()
           Returns the inside length of the tick marks.
 float getTickMarkOutsideLength()
           Returns the outside length of the tick marks.
 java.awt.Paint getTickMarkPaint()
           Returns the paint used to draw tick marks (if they are showing).
 java.awt.Stroke getTickMarkStroke()
           Returns the stroke used to draw tick marks.
 double getUpperMargin()
           Returns the upper margin for the axis.
 int hashCode()
           Returns a hash code value for the object.
 boolean hasListener(java.util.EventListener listener)
           Returns true if the specified object is registered with the dataset as a listener.
 boolean isAutoSelectTickLabelAlign()
           Sets whether or not auto select label alignment.
 boolean isAxisLabelVisible()
           Returns true if the axis label is visible, and false otherwise.
 boolean isAxisLineVisible()
           A flag that controls whether or not the axis line is drawn.
 boolean isDrawEmptyLabelTickMark()
           Returns a boolean flag controls whether or not draw tick mark with empty label.
 boolean isGridLineVisible()
           Returns the flag indicate whether or not grid line is visible.
 boolean isTickLabelsVisible()
           Returns a flag indicating whether or not the tick labels are visible.
 boolean isTickMarkVisible()
           Returns the flag that indicates whether or not the tick marks are showing.
 boolean isVisible()
           Returns true if the axis is visible, and false otherwise.
protected  void notifyListeners(AxisChangeEvent event)
           Notifies all registered listeners that the axis has changed.
 void removeAllChangeListener()
           Deregisters all object for notification of changes to the axis.
 void removeChangeListener(IAxisChangeListener listener)
           Deregisters an object for notification of changes to the axis.
 void setAutoSelectTickLabelAlign(boolean autoSelectTickLabelAlign)
           Sets whether or not auto select label alignment.
 void setAxis3DFillPaint(java.awt.Paint axis3DFillPaint)
           Sets the paint used for fill 3d axis.
 void setAxisLabel(java.lang.String label)
           Sets the label for the axis and sends an AxisChangeEvent to all registered listeners.
 void setAxisLabelAngle(double angle)
           Sets the angle for the label and sends an AxisChangeEvent to all registered listeners.
 void setAxisLabelFont(java.awt.Font font)
           Sets the font for the axis label and sends an AxisChangeEvent to all registered listeners.
 void setAxisLabelHorizontalAlign(HorizontalAlignment horizontalAlign)
           Sets the label horizontal alignment and sends an AxisChangeEvent to all registered listeners.
 void setAxisLabelInsets(RectangleInsets insets)
           Sets the insets for the axis label, and sends an AxisChangeEvent to all registered listeners.
 void setAxisLabelPaint(java.awt.Paint paint)
           Sets the paint used to draw the axis label and sends an AxisChangeEvent to all registered listeners.
 void setAxisLabelType(AxisLabelType axisLabelType)
           Sets the axis label type and sends an AxisChangeEvent to all registered listeners.
 void setAxisLabelVisible(boolean visible)
           Sets a flag that controls whether or not the axis label is visible and sends an AxisChangeEvent to all registered listeners.
 void setAxisLinePaint(java.awt.Paint paint)
           Sets the paint used to draw the axis line and sends an AxisChangeEvent to all registered listeners.
 void setAxisLineStroke(java.awt.Stroke stroke)
           Sets the stroke used to draw the axis line and sends an AxisChangeEvent to all registered listeners.
 void setAxisLineVisible(boolean visible)
           Sets a flag that controls whether or not the axis line is visible and sends an AxisChangeEvent to all registered listeners.
 void setColKeyFormatter(IFormatter colKeyFormatter)
           Sets the formatter for format the colKeys in dataset and sends an AxisChangeEvent to all registered listeners.
 void setDataFormatter(IFormatter dataFormatter)
           Sets the formatter for format the data in dataset and sends an AxisChangeEvent to all registered listeners.
 void setDataset(IMatrixDataset dataset)
           Sets dataset for this axis and sends an AxisChangeEvent to all registered listeners.
 void setDrawEmptyLabelTickMark(boolean flag)
           Sets a boolean flag controls whether or not draw tick mark with empty label and sends a RenderChangeEvent to all registered listeners.
 void setFixedAxisSpace(double space)
           Sets the fixed axis space and sends an AxisChangeEvent to all registered listeners.
 void setGridLineVisible(boolean flag)
           Sets a flag indicate whether or not grid line is visible and sends an AxisChangeEvent to all registered listeners.
 void setLowerMargin(double margin)
           Sets the lower margin for the axis and sends an AxisChangeEvent to all registered listeners.
 void setMaximumCategoryLabelWidthRatio(float ratio)
           Sets the maximum category label width ratio and sends an AxisChangeEvent to all registered listeners.
 void setRowKeyFormatter(IFormatter rowKeyFormatter)
           Sets the formatter for format the rowKeys in dataset and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelAngle(double tickLabelAngle)
          * Sets the tick label angle (in radians) and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelFont(java.awt.Font font)
           Sets the font for the tick labels and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelFont(java.lang.Object tickLabel, java.awt.Font font)
           Sets the font for the tick label and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelHorizontalAlign(HorizontalAlignment horizontalAlign)
           Sets the tick label horizontal alignment and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelInsets(RectangleInsets insets)
           Sets the insets for the tick labels and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelPaint(java.lang.Object tickLabel, java.awt.Paint paint)
           Sets the paint for the axis tick label and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelPaint(java.awt.Paint paint)
           Sets the paint used to draw tick labels (if they are showing) and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelsVisible(boolean flag)
           Sets the flag that determines whether or not the tick labels are visible and sends an AxisChangeEvent to all registered listeners.
 void setTickLabelVerticalAlign(VerticalAlignment verticalAlign)
           Sets the tick label vertical alignment and sends an AxisChangeEvent to all registered listeners.
 void setTickMarkInsideLength(float length)
           Sets the inside length of the tick marks and sends an AxisChangeEvent to all registered listeners.
 void setTickMarkOutsideLength(float length)
           Sets the outside length of the tick marks and sends an AxisChangeEvent to all registered listeners.
 void setTickMarkPaint(java.awt.Paint paint)
           Sets the paint used to draw tick marks and sends an AxisChangeEvent to all registered listeners.
 void setTickMarkStroke(java.awt.Stroke stroke)
           Sets the stroke used to draw tick marks and sends an AxisChangeEvent to all registered listeners.
 void setTickMarkVisible(boolean flag)
           Sets the flag that indicates whether or not the tick marks are showing and sends an AxisChangeEvent to all registered listeners.
 void setUpperMargin(double margin)
           Sets the upper margin for the axis and sends an AxisChangeEvent to all registered listeners.
 void setVisible(boolean visible)
           Sets a flag that controls whether or not the axis is visible and sends an AxisChangeEvent to all registered listeners.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_AXIS_VISIBLE

public static final boolean DEFAULT_AXIS_VISIBLE
The default axis visibility.

See Also:
Constant Field Values

DEFAULT_AXIS_LABEL_FONT

public static final java.awt.Font DEFAULT_AXIS_LABEL_FONT
The default axis label font.


DEFAULT_AXIS_LABEL_PAINT

public static final java.awt.Paint DEFAULT_AXIS_LABEL_PAINT
The default axis label paint.


DEFAULT_AXIS_LABEL_INSETS

public static final RectangleInsets DEFAULT_AXIS_LABEL_INSETS
The default axis label insets.


DEFAULT_AXIS_LINE_VISIBLE

public static final boolean DEFAULT_AXIS_LINE_VISIBLE
A default flag that controls whether or not the axis line is visible.

See Also:
Constant Field Values

DEFAULT_AXIS_LINE_PAINT

public static final java.awt.Paint DEFAULT_AXIS_LINE_PAINT
The default axis line paint.


DEFAULT_3D_AXIS_FILL_PAINT

public static final java.awt.Paint DEFAULT_3D_AXIS_FILL_PAINT
The default paint used for fill 3d axis.


DEFAULT_AXIS_LINE_STROKE

public static final java.awt.Stroke DEFAULT_AXIS_LINE_STROKE
The default axis line stroke.


DEFAULT_TICK_LABELS_VISIBLE

public static final boolean DEFAULT_TICK_LABELS_VISIBLE
The default tick labels visibility.

See Also:
Constant Field Values

DEFAULT_TICK_LABEL_FONT

public static final java.awt.Font DEFAULT_TICK_LABEL_FONT
The default tick label font.


DEFAULT_TICK_LABEL_PAINT

public static final java.awt.Paint DEFAULT_TICK_LABEL_PAINT
The default tick label paint.


DEFAULT_TICK_LABEL_INSETS

public static final RectangleInsets DEFAULT_TICK_LABEL_INSETS
The default tick label insets.


DEFAULT_TICK_MARKS_VISIBLE

public static final boolean DEFAULT_TICK_MARKS_VISIBLE
The default tick marks visible.

See Also:
Constant Field Values

DEFAULT_AXIS_LABEL_VISIBLE

public static final boolean DEFAULT_AXIS_LABEL_VISIBLE
The default axis label visible.

See Also:
Constant Field Values

DEFAULT_TICK_MARK_STROKE

public static final java.awt.Stroke DEFAULT_TICK_MARK_STROKE
The default tick stroke.


DEFAULT_TICK_MARK_PAINT

public static final java.awt.Paint DEFAULT_TICK_MARK_PAINT
The default tick paint.


DEFAULT_GRID_LINE_VISIBLE

public static final boolean DEFAULT_GRID_LINE_VISIBLE
A default flag indicate whether or not grid line is visible.

See Also:
Constant Field Values

DEFAULT_TICK_MARK_INSIDE_LENGTH

public static final float DEFAULT_TICK_MARK_INSIDE_LENGTH
The default tick mark inside length.

See Also:
Constant Field Values

DEFAULT_TICK_MARK_OUTSIDE_LENGTH

public static final float DEFAULT_TICK_MARK_OUTSIDE_LENGTH
The default tick mark outside length.

See Also:
Constant Field Values

DEFAULT_TICK_LABEL_HORIZONTAL_ALIGNMENT

public static final HorizontalAlignment DEFAULT_TICK_LABEL_HORIZONTAL_ALIGNMENT
The default tick label horizontal alignment.


DEFAULT_TICK_LABEL_VERTICAL_ALIGNMENT

public static final VerticalAlignment DEFAULT_TICK_LABEL_VERTICAL_ALIGNMENT
The default tick label vertical alignment.


DEFAULT_LABEL_HORIZONTAL_ALIGNMENT

public static final HorizontalAlignment DEFAULT_LABEL_HORIZONTAL_ALIGNMENT
The default label horizontal alignment.


DEFAULT_AUTO_SELECT_TICK_LABEL_ALIGN

public static final boolean DEFAULT_AUTO_SELECT_TICK_LABEL_ALIGN
The default auto selec label alignment value.

See Also:
Constant Field Values

DEFAULT_AXIS_MARGIN

public static final double DEFAULT_AXIS_MARGIN
The default margin for the axis (used for both lower and upper margins).

See Also:
Constant Field Values

WIDTH_TICK_MARK_AND_TICK_LABEL

public static final double WIDTH_TICK_MARK_AND_TICK_LABEL
The space width between tick mark and tick label.

See Also:
Constant Field Values

DEFAULT_AXIS_LABEL_TYPE

public static final AxisLabelType DEFAULT_AXIS_LABEL_TYPE
The default axis label type.


DEFAULT_FIXED_AXIS_SPACE

public static final double DEFAULT_FIXED_AXIS_SPACE
The default fixed axis space.

See Also:
Constant Field Values

DEFAULT_MAXIMUM_CATEGORY_LABEL_WIDTH_RATIO

public static final float DEFAULT_MAXIMUM_CATEGORY_LABEL_WIDTH_RATIO
The default ratio that is multiplied by the width of one category to determine the maximum label width.

See Also:
Constant Field Values

DEFAULT_DRAW_EMPTY_LABEL_TICK_MARK

public static final boolean DEFAULT_DRAW_EMPTY_LABEL_TICK_MARK
A default flag the controls whether or not draw tick mark with empty label.

See Also:
Constant Field Values
Constructor Detail

AbstractAxis

protected AbstractAxis(IMatrixDataset dataset)
Constructs an axis using a dataset.

Parameters:
dataset - IMatrixDataset The two dimension matrix dataset (null not permitted).

AbstractAxis

protected AbstractAxis(java.lang.String label,
                       IMatrixDataset dataset)
Constructs an axis using label and a dataset.

Parameters:
label - The axis label (null permitted).
dataset - IMatrixDataset The two dimension matrix dataset (null not permitted).
Method Detail

isVisible

public boolean isVisible()
Returns true if the axis is visible, and false otherwise.

Returns:
A boolean.

setVisible

public void setVisible(boolean visible)
Sets a flag that controls whether or not the axis is visible and sends an AxisChangeEvent to all registered listeners.

Parameters:
visible - the flag.

isAxisLabelVisible

public boolean isAxisLabelVisible()
Returns true if the axis label is visible, and false otherwise.

Returns:
A boolean.

setAxisLabelVisible

public void setAxisLabelVisible(boolean visible)
Sets a flag that controls whether or not the axis label is visible and sends an AxisChangeEvent to all registered listeners.

Parameters:
visible - the flag.

getAxisLabel

public java.lang.String getAxisLabel()
Returns the label for the axis.

Returns:
The label for the axis (null possible).

setAxisLabel

public void setAxisLabel(java.lang.String label)
Sets the label for the axis and sends an AxisChangeEvent to all registered listeners.

Parameters:
label - The new label (null permitted).

getAxisLabelFont

public java.awt.Font getAxisLabelFont()
Returns the font for the axis label.

Returns:
The font (never null).

setAxisLabelFont

public void setAxisLabelFont(java.awt.Font font)
Sets the font for the axis label and sends an AxisChangeEvent to all registered listeners.

Parameters:
font - The font (null not permitted).

getAxisLabelPaint

public java.awt.Paint getAxisLabelPaint()
Returns the color/shade used to draw the axis label.

Returns:
The paint (never null).

setAxisLabelPaint

public void setAxisLabelPaint(java.awt.Paint paint)
Sets the paint used to draw the axis label and sends an AxisChangeEvent to all registered listeners.

Parameters:
paint - The paint (null not permitted).

getAxisLabelInsets

public RectangleInsets getAxisLabelInsets()
Returns the insets for the label (that is, the amount of blank space that should be left around the label).

Returns:
The label insets (never null).

setAxisLabelInsets

public void setAxisLabelInsets(RectangleInsets insets)
Sets the insets for the axis label, and sends an AxisChangeEvent to all registered listeners.

Parameters:
insets - The insets (null not permitted).

getAxisLabelAngle

public double getAxisLabelAngle()
Returns the angle of the axis label.

Returns:
The angle (in radians).

setAxisLabelAngle

public void setAxisLabelAngle(double angle)
Sets the angle for the label and sends an AxisChangeEvent to all registered listeners.

Parameters:
angle - The angle (in radians).

isAxisLineVisible

public boolean isAxisLineVisible()
A flag that controls whether or not the axis line is drawn.

Returns:
A boolean.

setAxisLineVisible

public void setAxisLineVisible(boolean visible)
Sets a flag that controls whether or not the axis line is visible and sends an AxisChangeEvent to all registered listeners.

Parameters:
visible - the flag.

getAxisLinePaint

public java.awt.Paint getAxisLinePaint()
Returns the paint used to draw the axis line.

Returns:
The paint (never null).

setAxisLinePaint

public void setAxisLinePaint(java.awt.Paint paint)
Sets the paint used to draw the axis line and sends an AxisChangeEvent to all registered listeners.

Parameters:
paint - The paint (null not permitted).

getAxis3DFillPaint

public java.awt.Paint getAxis3DFillPaint()
Returns the paint used for fill 3d axis.

Returns:
Paint The paint used for fill 3d axis.

setAxis3DFillPaint

public void setAxis3DFillPaint(java.awt.Paint axis3DFillPaint)
Sets the paint used for fill 3d axis.

Parameters:
axis3DFillPaint - Paint The paint used for fill 3d axis.

getAxisLineStroke

public java.awt.Stroke getAxisLineStroke()
Returns the stroke used to draw the axis line.

Returns:
The stroke (never null).

setAxisLineStroke

public void setAxisLineStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the axis line and sends an AxisChangeEvent to all registered listeners.

Parameters:
stroke - The stroke (null not permitted).

isTickLabelsVisible

public boolean isTickLabelsVisible()
Returns a flag indicating whether or not the tick labels are visible.

Returns:
The flag.

setTickLabelsVisible

public void setTickLabelsVisible(boolean flag)
Sets the flag that determines whether or not the tick labels are visible and sends an AxisChangeEvent to all registered listeners.

Parameters:
flag - the flag.

getTickLabelFont

public java.awt.Font getTickLabelFont()
Returns the font used for the tick labels (if showing).

Returns:
The font (never null).

setTickLabelFont

public void setTickLabelFont(java.awt.Font font)
Sets the font for the tick labels and sends an AxisChangeEvent to all registered listeners.

Parameters:
font - The font (null not allowed).

getTickLabelPaint

public java.awt.Paint getTickLabelPaint()
Returns the color/shade used for the tick labels.

Returns:
The paint used for the tick labels.

setTickLabelPaint

public void setTickLabelPaint(java.awt.Paint paint)
Sets the paint used to draw tick labels (if they are showing) and sends an AxisChangeEvent to all registered listeners.

Parameters:
paint - The paint (null not permitted).

getTickLabelPaint

public java.awt.Paint getTickLabelPaint(java.lang.Object tickLabel)
Returns the color/shade used for the tick labels.

Parameters:
tickLabel - Object The axis tick label (null permitted).
Returns:
The paint used for the specified tick label.

setTickLabelPaint

public void setTickLabelPaint(java.lang.Object tickLabel,
                              java.awt.Paint paint)
Sets the paint for the axis tick label and sends an AxisChangeEvent to all registered listeners.

Parameters:
tickLabel - Object The axis tick label (null not permitted).
paint - Paint The paint (null permitted).

getTickLabelInsets

public RectangleInsets getTickLabelInsets()
Returns the insets for the tick labels.

Returns:
The insets (never null).

setTickLabelInsets

public void setTickLabelInsets(RectangleInsets insets)
Sets the insets for the tick labels and sends an AxisChangeEvent to all registered listeners.

Parameters:
insets - The insets (null not permitted).

isTickMarkVisible

public boolean isTickMarkVisible()
Returns the flag that indicates whether or not the tick marks are showing.

Returns:
The flag that indicates whether or not the tick marks are showing.

setTickMarkVisible

public void setTickMarkVisible(boolean flag)
Sets the flag that indicates whether or not the tick marks are showing and sends an AxisChangeEvent to all registered listeners.

Parameters:
flag - the flag.

getTickMarkInsideLength

public float getTickMarkInsideLength()
Returns the inside length of the tick marks.

Returns:
The length.

setTickMarkInsideLength

public void setTickMarkInsideLength(float length)
Sets the inside length of the tick marks and sends an AxisChangeEvent to all registered listeners.

Parameters:
length - The new length.

getTickMarkOutsideLength

public float getTickMarkOutsideLength()
Returns the outside length of the tick marks.

Returns:
The length.

setTickMarkOutsideLength

public void setTickMarkOutsideLength(float length)
Sets the outside length of the tick marks and sends an AxisChangeEvent to all registered listeners.

Parameters:
length - The new length.

getTickMarkStroke

public java.awt.Stroke getTickMarkStroke()
Returns the stroke used to draw tick marks.

Returns:
The stroke (never null).

setTickMarkStroke

public void setTickMarkStroke(java.awt.Stroke stroke)
Sets the stroke used to draw tick marks and sends an AxisChangeEvent to all registered listeners.

Parameters:
stroke - The stroke (null not permitted).

getTickMarkPaint

public java.awt.Paint getTickMarkPaint()
Returns the paint used to draw tick marks (if they are showing).

Returns:
The paint (never null).

setTickMarkPaint

public void setTickMarkPaint(java.awt.Paint paint)
Sets the paint used to draw tick marks and sends an AxisChangeEvent to all registered listeners.

Parameters:
paint - The paint (null not permitted).

isGridLineVisible

public boolean isGridLineVisible()
Returns the flag indicate whether or not grid line is visible.

Returns:
boolean A boolean.

setGridLineVisible

public void setGridLineVisible(boolean flag)
Sets a flag indicate whether or not grid line is visible and sends an AxisChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

addChangeListener

public void addChangeListener(IAxisChangeListener listener)
Registers an object for notification of changes to the axis.

Parameters:
listener - The object that is being registered.

getDataset

public IMatrixDataset getDataset()
Return the dataset.

Returns:
IMatrixDataset

setDataset

public void setDataset(IMatrixDataset dataset)
Sets dataset for this axis and sends an AxisChangeEvent to all registered listeners.

Parameters:
dataset - IMatrixDataset A instance of IMatrixDataset (null not permitted).

getRowKeyFormatter

public IFormatter getRowKeyFormatter()
Returns the formatter for format the rowKeys in dataset.

Returns:
IFormatter

setRowKeyFormatter

public void setRowKeyFormatter(IFormatter rowKeyFormatter)
Sets the formatter for format the rowKeys in dataset and sends an AxisChangeEvent to all registered listeners.

Parameters:
rowKeyFormatter - IFormatter A IFormatter.

getColKeyFormatter

public IFormatter getColKeyFormatter()
Returns the formatter for format the colKeys in dataset.

Returns:
IFormatter

setColKeyFormatter

public void setColKeyFormatter(IFormatter colKeyFormatter)
Sets the formatter for format the colKeys in dataset and sends an AxisChangeEvent to all registered listeners.

Parameters:
colKeyFormatter - IFormatter A IFormatter.

getDataFormatter

public IFormatter getDataFormatter()
Returns the formatter for format the data in dataset.

Returns:
IFormatter

setDataFormatter

public void setDataFormatter(IFormatter dataFormatter)
Sets the formatter for format the data in dataset and sends an AxisChangeEvent to all registered listeners.

Parameters:
dataFormatter - IFormatter A IFormatter.

getTickLabelAngle

public double getTickLabelAngle()
Returns the tick label angle (in radians).

Returns:
double The tick label angle (in radians).

setTickLabelAngle

public void setTickLabelAngle(double tickLabelAngle)
* Sets the tick label angle (in radians) and sends an AxisChangeEvent to all registered listeners.

Parameters:
tickLabelAngle - double The tick label angle (in radians).

setTickLabelHorizontalAlign

public void setTickLabelHorizontalAlign(HorizontalAlignment horizontalAlign)
Sets the tick label horizontal alignment and sends an AxisChangeEvent to all registered listeners.

Parameters:
horizontalAlign - HorizontalAlignment The tick label horizontal alignment (null not permitted).

getTickLabelHorizontalAlign

public HorizontalAlignment getTickLabelHorizontalAlign()
Returns the tick label horizontal alignment.

Returns:
HorizontalAlignment The tick label horizontal alignment.

setTickLabelVerticalAlign

public void setTickLabelVerticalAlign(VerticalAlignment verticalAlign)
Sets the tick label vertical alignment and sends an AxisChangeEvent to all registered listeners.

Parameters:
verticalAlign - VerticalAlignment The tick label vertical alignment (null not permitted).

getTickLabelVerticalAlign

public VerticalAlignment getTickLabelVerticalAlign()
Returns the tick label vertical alignment.

Returns:
VerticalAlignment The tick label vertical alignment.

setAxisLabelHorizontalAlign

public void setAxisLabelHorizontalAlign(HorizontalAlignment horizontalAlign)
Sets the label horizontal alignment and sends an AxisChangeEvent to all registered listeners.

Parameters:
horizontalAlign - HorizontalAlignment The label horizontal alignment (null not permitted).

getAxisLabelHorizontalAlign

public HorizontalAlignment getAxisLabelHorizontalAlign()
Returns the label horizontal alignment.

Returns:
HorizontalAlignment The label horizontal alignment.

setAutoSelectTickLabelAlign

public void setAutoSelectTickLabelAlign(boolean autoSelectTickLabelAlign)
Sets whether or not auto select label alignment.

Parameters:
autoSelectTickLabelAlign - boolean A boolean.

isAutoSelectTickLabelAlign

public boolean isAutoSelectTickLabelAlign()
Sets whether or not auto select label alignment.

Returns:
boolean A boolean.

getMaximumCategoryLabelWidthRatio

public float getMaximumCategoryLabelWidthRatio()
Returns the category label width ratio.

Returns:
The ratio.

setMaximumCategoryLabelWidthRatio

public void setMaximumCategoryLabelWidthRatio(float ratio)
Sets the maximum category label width ratio and sends an AxisChangeEvent to all registered listeners.

Parameters:
ratio - The ratio.

getTickLabelFont

public java.awt.Font getTickLabelFont(java.lang.Object tickLabel)
Returns the font used for the specified tick label (if showing).

Parameters:
tickLabel - The axis tick label (null permitted).
Returns:
The font (never null).

setTickLabelFont

public void setTickLabelFont(java.lang.Object tickLabel,
                             java.awt.Font font)
Sets the font for the tick label and sends an AxisChangeEvent to all registered listeners.

Parameters:
tickLabel - Object The axis tick label (null not permitted).
font - Font The font (null permitted).

getAxisLabelType

public AxisLabelType getAxisLabelType()
Returns the axis label type.

Returns:
AxisLabelType The axis label type (never null).

setAxisLabelType

public void setAxisLabelType(AxisLabelType axisLabelType)
Sets the axis label type and sends an AxisChangeEvent to all registered listeners.

Parameters:
axisLabelType - AxisLabelType The axis label type (never null).

getFixedAxisSpace

public double getFixedAxisSpace()
Returns the fixed axis space.

Specified by:
getFixedAxisSpace in interface IAxis
Returns:
double The fixed axis space (maybe null).

setFixedAxisSpace

public void setFixedAxisSpace(double space)
Sets the fixed axis space and sends an AxisChangeEvent to all registered listeners.

Parameters:
space - double The fixed axis space (null permitted).

isDrawEmptyLabelTickMark

public boolean isDrawEmptyLabelTickMark()
Returns a boolean flag controls whether or not draw tick mark with empty label.

Returns:
boolean A boolean.

setDrawEmptyLabelTickMark

public void setDrawEmptyLabelTickMark(boolean flag)
Sets a boolean flag controls whether or not draw tick mark with empty label and sends a RenderChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

calculateAxisSpace

public double calculateAxisSpace(java.awt.Graphics2D g2,
                                 java.awt.geom.Rectangle2D plotArea,
                                 java.awt.geom.Rectangle2D maxAxisArea,
                                 RectangleEdge edge)
Calculation the width or height of painting coordinate axis.

Specified by:
calculateAxisSpace in interface IAxis
Parameters:
g2 - Graphics2D The graphics device (null not permitted).
plotArea - Rectangle2D The area within which the plot should be drawn.
maxAxisArea - Rectangle2D The maximum area within which the axis should be drawn.
edge - RectangleEdge The axis position.
Returns:
double The width or height.

getTickLabelLines

protected int getTickLabelLines()
Returns the line count of tick labels.

Returns:
int The line count.

getFormatedTickLabels

protected abstract java.lang.String[] getFormatedTickLabels(java.awt.Graphics2D g2,
                                                            java.awt.geom.Rectangle2D maxAxisArea,
                                                            RectangleEdge edge)
Returns the formated tick labels.

Parameters:
g2 - Graphics2D The graphics device (null not permitted).
maxAxisArea - Rectangle2D The maximum area within which the axis should be drawn (null not permitted).
edge - RectangleEdge The axis position (null not permitted).
Returns:
String[] The array of tick labels.

draw

public double draw(java.awt.Graphics2D g2,
                   java.awt.geom.Rectangle2D plotArea,
                   java.awt.geom.Rectangle2D axisArea,
                   RectangleEdge edge,
                   AxisShapeCollection shapeCollection,
                   boolean alignEdge)
Draw the X-axis or Y-axis on plot area(plotArea).All axis shape is stored in shapeCollection.

Specified by:
draw in interface IAxis
Parameters:
g2 - Graphics2D The graphics device (null not permitted).
plotArea - Rectangle2D The area within which the plot should be drawn.
axisArea - Rectangle2D The empty chart area.
edge - RectangleEdge The axis position.
shapeCollection - AxisShapeCollection Collects information about the axis (null permitted).
alignEdge - boolean Controls whether or not translate shapes when the draw area less than the axis area.
Returns:
double Drawing the actual coordinates axis width or height.

dawAxisLabel

protected double dawAxisLabel(java.awt.Graphics2D g2,
                              java.awt.geom.Rectangle2D axisArea,
                              RectangleEdge edge,
                              AxisShapeCollection shapeCollection,
                              double cursor)
Draw the axis label.

Parameters:
g2 - Graphics2D The graphics device (null not permitted).
axisArea - Rectangle2D The empty chart area.
edge - RectangleEdge The axis position.
shapeCollection - AxisShapeCollection Collects information about the axis (null permitted).
cursor - The cursor location.
Returns:
double The cursor location after draw axis label.

calculateLabelBound

protected java.awt.geom.Rectangle2D calculateLabelBound(java.awt.Graphics2D g2,
                                                        double labelMaxWidth,
                                                        double labelMaxHeight,
                                                        double labelAngle,
                                                        RectangleEdge edge,
                                                        java.lang.String[] seriesLabel,
                                                        java.awt.Font labelFont,
                                                        RectangleInsets inset)
Calculate the bound of draw a label.

Parameters:
g2 - Graphics2D The graphics device (null not permitted).
labelMaxWidth - double The max width of label.
labelMaxHeight - double The max height of label.
labelAngle - The rotate angle of label.
edge - RectangleEdge The axis position.
seriesLabel - String[] A series labels (for example: axis tick labels).
labelFont - Font The font of draw labels.
inset - The insets for the label
Returns:
Rectangle2D The bound.

getTickLabelRotateBound

protected java.awt.geom.Rectangle2D getTickLabelRotateBound(java.awt.geom.Rectangle2D rect,
                                                            double angle)
Returns the rotate bound of tick label bound.

Parameters:
rect - Rectangle2D The label bound.
angle - double The label rotate angle.
Returns:
Rectangle2D The rotate bound.

drawTickMark

protected abstract double drawTickMark(java.awt.Graphics2D g2,
                                       java.awt.geom.Rectangle2D axisArea,
                                       RectangleEdge edge,
                                       AxisShapeCollection shapeCollection,
                                       double cursor)
Draws tick marks in a specified area and edge.

Parameters:
g2 - Graphics2D The graphics device (null not permitted).
axisArea - Rectangle2D The empty chart area.
edge - RectangleEdge The axis position.
shapeCollection - AxisShapeCollection Collects information about the axis (null permitted).
cursor - The cursor location.
Returns:
double The cursor location after draw tick mark.

drawTickLabel

protected abstract double drawTickLabel(java.awt.Graphics2D g2,
                                        java.awt.geom.Rectangle2D plotArea,
                                        java.awt.geom.Rectangle2D axisArea,
                                        RectangleEdge edge,
                                        AxisShapeCollection shapeCollection,
                                        double cursor)
Draws tick mark labels in a specified area and edge.

Parameters:
g2 - Graphics2D The graphics device (null not permitted).
plotArea - Rectangle2D The area within which the plot should be drawn.
axisArea - Rectangle2D The empty chart area.
edge - RectangleEdge The axis position.
shapeCollection - AxisShapeCollection Collects information about the axis (null permitted).
cursor - The cursor location.
Returns:
double The cursor location after draw tick label.

drawAxisLine

protected double drawAxisLine(java.awt.geom.Rectangle2D axisArea,
                              RectangleEdge edge,
                              AxisShapeCollection shapeCollection)
Draws an axis line in a specified area and edge.

Parameters:
axisArea - Rectangle2D The empty chart area (null not permitted).
edge - RectangleEdge The axis position (null not permitted).
shapeCollection - AxisShapeCollection Collects information about the axis (null not permitted).
Returns:
double The cursor location.

drawAxis3DLine

protected double drawAxis3DLine(IEffect3D effect3D,
                                java.awt.geom.Rectangle2D axisArea,
                                RectangleEdge edge,
                                AxisShapeCollection shapeCollection)
Draws an axis line in a specified area and edge.

Parameters:
effect3D - IEffect3D The 3D effect.
axisArea - Rectangle2D The empty chart area (null not permitted).
edge - RectangleEdge The axis position (null not permitted).
shapeCollection - AxisShapeCollection Collects information about the axis (null not permitted).
Returns:
double The cursor location.

createAxisLabelChartShape

protected IChartShape createAxisLabelChartShape(java.awt.geom.Rectangle2D axisLabelDrawRect)
Create a RectangleTextChartShape object.

Parameters:
axisLabelDrawRect - Rectangle2D The axis label bound.
Returns:
IChartShape A IChartShape.

getLowerMargin

public double getLowerMargin()
Returns the lower margin for the axis.

Returns:
The margin (in percent).

setLowerMargin

public void setLowerMargin(double margin)
Sets the lower margin for the axis and sends an AxisChangeEvent to all registered listeners.

Parameters:
margin - The margin as a percentage of the axis length (for example, 0.05 is five percent).

getUpperMargin

public double getUpperMargin()
Returns the upper margin for the axis.

Returns:
The margin (in percent).

setUpperMargin

public void setUpperMargin(double margin)
Sets the upper margin for the axis and sends an AxisChangeEvent to all registered listeners.

Parameters:
margin - The margin as a percentage of the axis length (for example, 0.05 is five percent).

drawGridLine

public abstract void drawGridLine(java.awt.Graphics2D g2,
                                  java.awt.geom.Rectangle2D dataArea,
                                  RectangleEdge axisEdge,
                                  RenderShapeCollection shapeCollection,
                                  java.awt.Stroke stroke,
                                  java.awt.Paint paint)
Draw the grid line,only call after IAxis.draw().

Parameters:
g2 - Graphics2D The graphics device (null not permitted).
dataArea - Rectangle2D The area within which the data should be drawn (null not permitted).
axisEdge - RectangleEdge The axis position (null not permitted).
shapeCollection - RenderShapeCollection Collects information about the render (null not permitted).
stroke - Stroke The grid line stroke.
paint - Paint The grid line paint (null not permitted).

removeChangeListener

public void removeChangeListener(IAxisChangeListener listener)
Deregisters an object for notification of changes to the axis.

Parameters:
listener - The object to deregister.

removeAllChangeListener

public void removeAllChangeListener()
Deregisters all object for notification of changes to the axis.


hasListener

public boolean hasListener(java.util.EventListener listener)
Returns true if the specified object is registered with the dataset as a listener. Most applications won't need to call this method, it exists mainly for use by unit testing code.

Parameters:
listener - the listener.
Returns:
A boolean.

fireAxisChanged

protected void fireAxisChanged()
Notifies all registered listeners that the axis has changed.


notifyListeners

protected void notifyListeners(AxisChangeEvent event)
Notifies all registered listeners that the axis has changed. The AxisChangeEvent provides information about the change.

Parameters:
event - information about the change to the axis.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the axis.

Overrides:
clone in class java.lang.Object
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if some component of the axis does not support cloning.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this object.

equals

public boolean equals(java.lang.Object obj)
Tests this axis for equality with another object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object (null permitted).
Returns:
true or false.