com.ijchart.xychart.axis.value
Class AbstractValueAxis

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

public abstract class AbstractValueAxis
extends AbstractAxis
implements IMarkerChangeListener, java.lang.Cloneable, java.io.Serializable

Title: IJChart

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

An axis that displays values (Y-Axis).

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 boolean DEFAULT_AXIS_TICK_INCLUDE_ZERO
           The default value for the axisRangeIncludeZero flag.
static java.awt.Paint DEFAULT_CROSSHAIR_PAINT
           The default crosshair line paint.
static java.awt.Stroke DEFAULT_CROSSHAIR_STROKE
           The default value line stroke.
static java.awt.Paint DEFAULT_GRID_BAND_ALTERNATE_PAINT
           The default paint for alternate grid bands.
static java.awt.Paint DEFAULT_GRID_BAND_PAINT
           The default grid band paint.
static boolean DEFAULT_GRID_BAND_VISIBLE
           The default flag that indicates whether or not grid bands are visible.
static boolean DEFAULT_INVERTED
           The default inverted flag setting.
static boolean DEFAULT_VALUE_LINE_VISIBLE
           The default crosshair visibility.
static java.awt.Paint DEFAULT_VALUE_PAINT
           The default value line paint.
static double INVALID_COORDINATE_VALUE
           If the value not between the minimum and maximum of axis tick mark,this axis in the coordinates did not correspond to a point.
 
Fields inherited from class com.ijchart.xychart.axis.AbstractAxis
DEFAULT_3D_AXIS_FILL_PAINT, DEFAULT_AUTO_SELECT_TICK_LABEL_ALIGN, DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_AXIS_LABEL_TYPE, DEFAULT_AXIS_LABEL_VISIBLE, DEFAULT_AXIS_LINE_PAINT, DEFAULT_AXIS_LINE_STROKE, DEFAULT_AXIS_LINE_VISIBLE, DEFAULT_AXIS_MARGIN, DEFAULT_AXIS_VISIBLE, DEFAULT_DRAW_EMPTY_LABEL_TICK_MARK, DEFAULT_FIXED_AXIS_SPACE, DEFAULT_GRID_LINE_VISIBLE, DEFAULT_LABEL_HORIZONTAL_ALIGNMENT, DEFAULT_MAXIMUM_CATEGORY_LABEL_WIDTH_RATIO, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_HORIZONTAL_ALIGNMENT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_LABEL_VERTICAL_ALIGNMENT, DEFAULT_TICK_LABELS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE, DEFAULT_TICK_MARKS_VISIBLE, WIDTH_TICK_MARK_AND_TICK_LABEL
 
Constructor Summary
protected AbstractValueAxis(IMatrixDataset dataset)
           Constructs an axis using a dataset.
protected AbstractValueAxis(java.lang.String label, IMatrixDataset dataset)
           Constructs an axis using label and a dataset.
 
Method Summary
 void addIntervalValueMarker(Layer layer, IntervalValueMarker marker)
           Adds a interval value marker for display by a particular render.
 void addValueMarker(Layer layer, ValueMarker marker)
           Adds a value marker for display by a particular render.
 void clearIntervalValueMarkers(Layer layer)
           Clears all the interval value markers for the plot and sends an AxisChangeEvent to all registered listeners.
 void clearValueMarkers(Layer layer)
           Clears all the value markers for the plot and sends an AxisChangeEvent to all registered listeners.
 java.lang.Object clone()
          Returns a clone of the object.
abstract  void drawValueLine(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, RectangleEdge edge, RenderShapeCollection shapeCollection)
           Draw the value line,only call after IAxis.draw().
 boolean equals(java.lang.Object obj)
           Tests the axis for equality with an arbitrary object.
abstract  NumberRange getDatasetRange()
           Returns the value range of a dataset.
 NumberRange getEmptyDatasetRange()
           Returns the default range is used when the dataset is empty and the axis needs to determine the auto range.
 java.awt.Paint getGridBandAlternatePaint()
           Returns the paint used to fill the alternate grid bands.
 java.awt.Paint getGridBandPaint()
           Returns the paint used to color the grid bands.
 java.util.Collection getIntervalValueMarkers(Layer layer)
           Returns a collection of interval value markers for specified layer.
 IRenderWithAxis getRender()
           Returns the render object.
 IFormatter getTickValueFormatter()
           Returns the tick value formatter.
 java.awt.Paint getValueLinePaint()
           Returns the paint used to draw the value line.
 java.awt.Stroke getValueLineStroke()
           Returns the pen-style (Stroke) used to draw the value line (if visible).
 double getValueLineValue()
           Returns the value line value.
 java.util.Collection getValueMarkers(Layer layer)
           Returns a collection of value markers for specified layer.
 int hashCode()
           Returns a hash code value for the object.
 boolean isAxisRangeIncludeZero()
           Returns the flag whether or not include zero when calculate the axis data range.
 boolean isGridBandVisible()
           Returns the flag that indicates whether or not grid bands are visible.
 boolean isInverted()
           Returns a flag that controls the direction of values on the axis.
 boolean isValueLineVisible()
           Returns the flag that controls whether or not a value line is drawn.
 void markerChanged(MarkerChangeEvent event)
           Receives notification of an marker change event.
 boolean removeValueMarker(Layer layer, IntervalValueMarker marker)
           Removes a interval marker for a specific layer and sends an AxisChangeEvent to all registered listeners.
 boolean removeValueMarker(Layer layer, ValueMarker marker)
           Removes a marker for a specific layer and sends an AxisChangeEvent to all registered listeners.
 void setAxisRangeIncludeZero(boolean flag)
           Sets the flag whether or not include zero when calculate the axis ticks,and notifies registered listeners that the axis has changed.
 void setEmptyDatasetRange(NumberRange range)
           Sets the default range is used when the dataset is empty and the axis needs to determine the auto range,and notifies registered listeners that the axis has changed.
 void setGridBandAlternatePaint(java.awt.Paint paint)
           Sets the paint used to fill the alternate grid bands and notifies registered listeners that the axis has changed.
 void setGridBandPaint(java.awt.Paint paint)
           Sets the paint used to color the grid bands and notifies registered listeners that the axis has changed.
 void setGridBandVisible(boolean visible)
           Sets the flag that indicates whether or not grid bands are visible and notifies registered listeners that the axis has changed.
 void setInverted(boolean flag)
           Sets a flag that controls the direction of values on the axis,and notifies registered listeners that the axis has changed.
 void setRender(IRenderWithAxis render)
           The render object.
 void setTickValueFormatter(IFormatter tickValueFormatter)
           Sets the tick value formatter,and notifies registered listeners that the axis has changed.
 void setValueLinePaint(java.awt.Paint paint)
           Sets the paint used to draw the value line (if visible) and sends an AxisChangeEvent to all registered listeners.
 void setValueLineStroke(java.awt.Stroke stroke)
           Sets the pen-style (Stroke) used to draw the value crosshair (if visible), and sends an AxisChangeEvent to all registered listeners.
 void setValueLineValue(double value)
           Sets the value line value and, if requested, sends an AxisChangeEvent to all registered listeners (but only if the value line is visible).
 void setValueLineVisible(boolean flag)
           Sets the flag indicating whether or not the value line is visible,and notifies registered listeners that the axis has changed.
 java.lang.String toString()
           Returns a string representation of the object.
abstract  double valueToJava2D(java.awt.geom.Rectangle2D dataArea, RectangleEdge edge, double value, boolean forceInDataArea)
           Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified dataArea.
abstract  double valueToJava2D(java.awt.geom.Rectangle2D dataArea, RectangleEdge edge, double value, boolean forceInDataArea, boolean expandAxisRange)
           Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified dataArea.
 
Methods inherited from class com.ijchart.xychart.axis.AbstractAxis
addChangeListener, calculateAxisSpace, calculateLabelBound, createAxisLabelChartShape, dawAxisLabel, draw, drawAxis3DLine, drawAxisLine, drawGridLine, drawTickLabel, drawTickMark, fireAxisChanged, getAxis3DFillPaint, getAxisLabel, getAxisLabelAngle, getAxisLabelFont, getAxisLabelHorizontalAlign, getAxisLabelInsets, getAxisLabelPaint, getAxisLabelType, getAxisLinePaint, getAxisLineStroke, getColKeyFormatter, getDataFormatter, getDataset, getFixedAxisSpace, getFormatedTickLabels, getLowerMargin, getMaximumCategoryLabelWidthRatio, getRowKeyFormatter, getTickLabelAngle, getTickLabelFont, getTickLabelFont, getTickLabelHorizontalAlign, getTickLabelInsets, getTickLabelLines, getTickLabelPaint, getTickLabelPaint, getTickLabelRotateBound, getTickLabelVerticalAlign, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, getUpperMargin, hasListener, isAutoSelectTickLabelAlign, isAxisLabelVisible, isAxisLineVisible, isDrawEmptyLabelTickMark, isGridLineVisible, isTickLabelsVisible, isTickMarkVisible, isVisible, notifyListeners, removeAllChangeListener, removeChangeListener, setAutoSelectTickLabelAlign, setAxis3DFillPaint, setAxisLabel, setAxisLabelAngle, setAxisLabelFont, setAxisLabelHorizontalAlign, setAxisLabelInsets, setAxisLabelPaint, setAxisLabelType, setAxisLabelVisible, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setColKeyFormatter, setDataFormatter, setDataset, setDrawEmptyLabelTickMark, setFixedAxisSpace, setGridLineVisible, setLowerMargin, setMaximumCategoryLabelWidthRatio, setRowKeyFormatter, setTickLabelAngle, setTickLabelFont, setTickLabelFont, setTickLabelHorizontalAlign, setTickLabelInsets, setTickLabelPaint, setTickLabelPaint, setTickLabelsVisible, setTickLabelVerticalAlign, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarkVisible, setUpperMargin, setVisible
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_AXIS_TICK_INCLUDE_ZERO

public static final boolean DEFAULT_AXIS_TICK_INCLUDE_ZERO
The default value for the axisRangeIncludeZero flag.

See Also:
Constant Field Values

DEFAULT_INVERTED

public static final boolean DEFAULT_INVERTED
The default inverted flag setting.

See Also:
Constant Field Values

DEFAULT_VALUE_LINE_VISIBLE

public static final boolean DEFAULT_VALUE_LINE_VISIBLE
The default crosshair visibility.

See Also:
Constant Field Values

DEFAULT_CROSSHAIR_STROKE

public static final java.awt.Stroke DEFAULT_CROSSHAIR_STROKE
The default value line stroke.


DEFAULT_CROSSHAIR_PAINT

public static final java.awt.Paint DEFAULT_CROSSHAIR_PAINT
The default crosshair line paint.


DEFAULT_VALUE_PAINT

public static final java.awt.Paint DEFAULT_VALUE_PAINT
The default value line paint.


INVALID_COORDINATE_VALUE

public static final double INVALID_COORDINATE_VALUE
If the value not between the minimum and maximum of axis tick mark,this axis in the coordinates did not correspond to a point.

See Also:
Constant Field Values

DEFAULT_GRID_BAND_PAINT

public static final java.awt.Paint DEFAULT_GRID_BAND_PAINT
The default grid band paint.


DEFAULT_GRID_BAND_ALTERNATE_PAINT

public static final java.awt.Paint DEFAULT_GRID_BAND_ALTERNATE_PAINT
The default paint for alternate grid bands.


DEFAULT_GRID_BAND_VISIBLE

public static final boolean DEFAULT_GRID_BAND_VISIBLE
The default flag that indicates whether or not grid bands are visible.

See Also:
Constant Field Values
Constructor Detail

AbstractValueAxis

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

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

AbstractValueAxis

protected AbstractValueAxis(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

isAxisRangeIncludeZero

public boolean isAxisRangeIncludeZero()
Returns the flag whether or not include zero when calculate the axis data range.

Returns:
boolean The flag.

setAxisRangeIncludeZero

public void setAxisRangeIncludeZero(boolean flag)
Sets the flag whether or not include zero when calculate the axis ticks,and notifies registered listeners that the axis has changed.

Parameters:
flag - boolean The new value of the flag.

isInverted

public boolean isInverted()
Returns a flag that controls the direction of values on the axis.

For a regular axis, values increase from left to right (for a horizontal axis) and bottom to top (for a vertical axis). When the axis is 'inverted', the values increase in the opposite direction.

Returns:
The flag.

setInverted

public void setInverted(boolean flag)
Sets a flag that controls the direction of values on the axis,and notifies registered listeners that the axis has changed.

Parameters:
flag - boolean The flag.

getEmptyDatasetRange

public NumberRange getEmptyDatasetRange()
Returns the default range is used when the dataset is empty and the axis needs to determine the auto range.

Returns:
NumberRange The range.

setEmptyDatasetRange

public void setEmptyDatasetRange(NumberRange range)
Sets the default range is used when the dataset is empty and the axis needs to determine the auto range,and notifies registered listeners that the axis has changed.

Parameters:
range - NumberRange (null not permitted).

getTickValueFormatter

public IFormatter getTickValueFormatter()
Returns the tick value formatter.

Returns:
IFormatter

setTickValueFormatter

public void setTickValueFormatter(IFormatter tickValueFormatter)
Sets the tick value formatter,and notifies registered listeners that the axis has changed.

Parameters:
tickValueFormatter - IFormatter The tick value formatter.

isValueLineVisible

public boolean isValueLineVisible()
Returns the flag that controls whether or not a value line is drawn.

Returns:
boolean The flag.

setValueLineVisible

public void setValueLineVisible(boolean flag)
Sets the flag indicating whether or not the value line is visible,and notifies registered listeners that the axis has changed.

Parameters:
flag - boolean The new value of the flag.

getValueLineValue

public double getValueLineValue()
Returns the value line value.

Returns:
boolean The value.

setValueLineValue

public void setValueLineValue(double value)
Sets the value line value and, if requested, sends an AxisChangeEvent to all registered listeners (but only if the value line is visible).

Parameters:
value - double The new value.

getValueLineStroke

public java.awt.Stroke getValueLineStroke()
Returns the pen-style (Stroke) used to draw the value line (if visible).

Returns:
Stroke The value line stroke (never null).

setValueLineStroke

public void setValueLineStroke(java.awt.Stroke stroke)
Sets the pen-style (Stroke) used to draw the value crosshair (if visible), and sends an AxisChangeEvent to all registered listeners.

Parameters:
stroke - Stroke The new value line stroke (null not permitted).

getValueLinePaint

public java.awt.Paint getValueLinePaint()
Returns the paint used to draw the value line.

Returns:
Paint The paint (never null).

setValueLinePaint

public void setValueLinePaint(java.awt.Paint paint)
Sets the paint used to draw the value line (if visible) and sends an AxisChangeEvent to all registered listeners.

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

isGridBandVisible

public boolean isGridBandVisible()
Returns the flag that indicates whether or not grid bands are visible.

Returns:
boolean The boolean.

setGridBandVisible

public void setGridBandVisible(boolean visible)
Sets the flag that indicates whether or not grid bands are visible and notifies registered listeners that the axis has changed.

Parameters:
visible - boolean The boolean.

getGridBandPaint

public java.awt.Paint getGridBandPaint()
Returns the paint used to color the grid bands.

Returns:
Paint The paint (never null).

setGridBandPaint

public void setGridBandPaint(java.awt.Paint paint)
Sets the paint used to color the grid bands and notifies registered listeners that the axis has changed.

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

getGridBandAlternatePaint

public java.awt.Paint getGridBandAlternatePaint()
Returns the paint used to fill the alternate grid bands.

Returns:
Paint The paint (never null).

setGridBandAlternatePaint

public void setGridBandAlternatePaint(java.awt.Paint paint)
Sets the paint used to fill the alternate grid bands and notifies registered listeners that the axis has changed.

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

getRender

public IRenderWithAxis getRender()
Returns the render object.

Returns:
IRenderWithAxis The render object (maybe null).

setRender

public void setRender(IRenderWithAxis render)
The render object.

Parameters:
render - IRenderWithAxis The render object (null permitted).

drawValueLine

public abstract void drawValueLine(java.awt.Graphics2D g2,
                                   java.awt.geom.Rectangle2D dataArea,
                                   RectangleEdge edge,
                                   RenderShapeCollection shapeCollection)
Draw the value 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).
edge - RectangleEdge The axis position (null not permitted).
shapeCollection - RenderShapeCollection Collects information about the render (null not permitted).

valueToJava2D

public abstract double valueToJava2D(java.awt.geom.Rectangle2D dataArea,
                                     RectangleEdge edge,
                                     double value,
                                     boolean forceInDataArea)
Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified dataArea.

Parameters:
dataArea - Rectangle2D The area within which the data should be drawn (null not permitted).
edge - RectangleEdge The axis position (null not permitted).
value - double The data value.
forceInDataArea - boolean Whether or not the return value force in the region dataArea.
Returns:
double The Java2D coordinate.

valueToJava2D

public abstract double valueToJava2D(java.awt.geom.Rectangle2D dataArea,
                                     RectangleEdge edge,
                                     double value,
                                     boolean forceInDataArea,
                                     boolean expandAxisRange)
Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified dataArea.

Parameters:
dataArea - Rectangle2D The area within which the data should be drawn (null not permitted).
edge - RectangleEdge The axis position (null not permitted).
value - double The data value.
forceInDataArea - boolean Whether or not the return value force in the region dataArea.
expandAxisRange - boolean Whether or not expand the range of axis.
Returns:
double The Java2D coordinate.

getDatasetRange

public abstract NumberRange getDatasetRange()
Returns the value range of a dataset.

Returns:
NumberRange The value range of a dataset (never null).

addValueMarker

public void addValueMarker(Layer layer,
                           ValueMarker marker)
Adds a value marker for display by a particular render.

Parameters:
layer - Layer The layer (foreground or background) (null not permitted).
marker - ValueMarker The marker (null not permitted).

getValueMarkers

public java.util.Collection getValueMarkers(Layer layer)
Returns a collection of value markers for specified layer.

Parameters:
layer - The layer (null not permitted).
Returns:
Collection A collection of markers (possibly null).

removeValueMarker

public boolean removeValueMarker(Layer layer,
                                 ValueMarker marker)
Removes a marker for a specific layer and sends an AxisChangeEvent to all registered listeners.

Parameters:
layer - Layer The layer (foreground or background) (null not permitted).
marker - ValueMarker The marker (null not permitted).
Returns:
A boolean indicating whether or not the marker was actually removed.

clearValueMarkers

public void clearValueMarkers(Layer layer)
Clears all the value markers for the plot and sends an AxisChangeEvent to all registered listeners.

Parameters:
layer - Layer The layer (foreground or background) (null not permitted).

addIntervalValueMarker

public void addIntervalValueMarker(Layer layer,
                                   IntervalValueMarker marker)
Adds a interval value marker for display by a particular render.

Parameters:
layer - Layer The layer (foreground or background) (null not permitted).
marker - IntervalValueMarker The marker (null not permitted).

getIntervalValueMarkers

public java.util.Collection getIntervalValueMarkers(Layer layer)
Returns a collection of interval value markers for specified layer.

Parameters:
layer - The layer (null not permitted).
Returns:
Collection A collection of markers (possibly null).

removeValueMarker

public boolean removeValueMarker(Layer layer,
                                 IntervalValueMarker marker)
Removes a interval marker for a specific layer and sends an AxisChangeEvent to all registered listeners.

Parameters:
layer - Layer The layer (foreground or background) (null not permitted).
marker - IntervalValueMarker The marker (null not permitted).
Returns:
A boolean indicating whether or not the marker was actually removed.

clearIntervalValueMarkers

public void clearIntervalValueMarkers(Layer layer)
Clears all the interval value markers for the plot and sends an AxisChangeEvent to all registered listeners.

Parameters:
layer - Layer The layer (foreground or background) (null not permitted).

markerChanged

public void markerChanged(MarkerChangeEvent event)
Receives notification of an marker change event.

Specified by:
markerChanged in interface IMarkerChangeListener
Parameters:
event - The marker change event.

equals

public boolean equals(java.lang.Object obj)
Tests the axis for equality with an arbitrary object.

Overrides:
equals in class AbstractAxis
Parameters:
obj - the object (null permitted).
Returns:
true or false.

clone

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

Overrides:
clone in class AbstractAxis
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 AbstractAxis
Returns:
A hash code value for this object.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the object.