com.ijchart.xychart.axis.category
Class GroupCategoryAxis

java.lang.Object
  extended by com.ijchart.xychart.axis.AbstractAxis
      extended by com.ijchart.xychart.axis.category.CategoryAxis
          extended by com.ijchart.xychart.axis.category.GroupCategoryAxis
All Implemented Interfaces:
IAxis, IMarkerChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class GroupCategoryAxis
extends CategoryAxis
implements IMarkerChangeListener, java.lang.Cloneable, java.io.Serializable

Title: IJChart

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

A group category axis that can display group-categories.

Copyright: Copyright (c) 2013

Company:

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

Field Summary
 
Fields inherited from class com.ijchart.xychart.axis.category.CategoryAxis
acategoryWidth, categoryLabelPosition, DEFAULT_CATEGORY_MARGIN, DEFAULT_HORIZONTAL_ALIGNMENT, DEFAULT_MAX_CATEGORY_LABEL_LINE
 
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
GroupCategoryAxis(AbstractCategoryRender categoryRender, IMatrixDataset dataset)
           Constructs an axis using a dataset.
GroupCategoryAxis(AbstractCategoryRender categoryRender, java.lang.String label, IMatrixDataset dataset)
           Constructs an axis using label and a dataset.
 
Method Summary
 void addSubCategoryAxis(CategoryAxis categoryAxis)
           Adds a sub-category to the axis and sends an AxisChangeEvent to all registered listeners.
 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.
 java.lang.Object clone()
           Creates a clone of the axis.
 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 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.
 boolean equals(java.lang.Object obj)
           Tests this axis for equality with an arbitrary object.
 AbstractCategoryRender getCategoryRender()
           Returns the render for category item.
protected  java.lang.String[] getFormatedTickLabels(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D maxAxisArea, RectangleEdge edge)
           Returns the formated tick labels.
 java.util.List getSubCategoryAxes()
           Returns the collection of sub-category axes,this list is unmodifiable.
 int getSubCategoryAxisCount()
           Returns the size of sub-category axes.
 int hashCode()
           Returns a hash code for this object.
 void removeAllSubCategoryAxes()
           Remove all sub-category axes.
 CategoryAxis removeSubCategoryAxis(int index)
           Removes the category at the specified position and sends an AxisChangeEvent to all registered listeners.
 void setCategoryRender(AbstractCategoryRender categoryRender)
           Sets the render for category item and sends an AxisChangeEvent to all registered listeners.
 
Methods inherited from class com.ijchart.xychart.axis.category.CategoryAxis
addCategoryMarker, categoryToJava2D, clearCategoryMarkers, createChartShape, drawGridLine, drawTickMark, getCategoryLabelHorizontalAlignment, getCategoryMargin, getCategoryMarkers, getLabelMaxDrawWidth, getMaximumCategoryLabelLines, markerChanged, removeCategoryMarker, setCategoryLabelHorizontalAlignment, setCategoryMargin, setMaximumCategoryLabelLines
 
Methods inherited from class com.ijchart.xychart.axis.AbstractAxis
addChangeListener, calculateLabelBound, createAxisLabelChartShape, dawAxisLabel, drawAxis3DLine, drawAxisLine, fireAxisChanged, getAxis3DFillPaint, getAxisLabel, getAxisLabelAngle, getAxisLabelFont, getAxisLabelHorizontalAlign, getAxisLabelInsets, getAxisLabelPaint, getAxisLabelType, getAxisLinePaint, getAxisLineStroke, getColKeyFormatter, getDataFormatter, getDataset, getFixedAxisSpace, 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, toString, wait, wait, wait
 
Methods inherited from interface com.ijchart.xychart.listener.IMarkerChangeListener
markerChanged
 

Constructor Detail

GroupCategoryAxis

public GroupCategoryAxis(AbstractCategoryRender categoryRender,
                         IMatrixDataset dataset)
Constructs an axis using a dataset.

Parameters:
categoryRender - AbstractCategoryRender The render for category item (null not permitted).
dataset - IMatrixDataset The two dimension matrix dataset (null not permitted).

GroupCategoryAxis

public GroupCategoryAxis(AbstractCategoryRender categoryRender,
                         java.lang.String label,
                         IMatrixDataset dataset)
Constructs an axis using label and a dataset.

Parameters:
categoryRender - AbstractCategoryRender The render for category item (null not permitted).
label - The axis label (null permitted).
dataset - IMatrixDataset The two dimension matrix dataset (null not permitted).
Method Detail

addSubCategoryAxis

public void addSubCategoryAxis(CategoryAxis categoryAxis)
Adds a sub-category to the axis and sends an AxisChangeEvent to all registered listeners.

Parameters:
categoryAxis - CategoryAxis The sub-category (null not permitted).

getSubCategoryAxisCount

public int getSubCategoryAxisCount()
Returns the size of sub-category axes.

Returns:
int The number of sub-category axes.

getSubCategoryAxes

public java.util.List getSubCategoryAxes()
Returns the collection of sub-category axes,this list is unmodifiable.

Returns:
List The axes list (never null).

removeSubCategoryAxis

public CategoryAxis removeSubCategoryAxis(int index)
Removes the category at the specified position and sends an AxisChangeEvent to all registered listeners.

Parameters:
index - int The index.
Returns:
CategoryAxis The removed CategoryAxis.

removeAllSubCategoryAxes

public void removeAllSubCategoryAxes()
Remove all sub-category axes.


getCategoryRender

public AbstractCategoryRender getCategoryRender()
Returns the render for category item.

Returns:
AbstractCategoryRender Never null.

setCategoryRender

public void setCategoryRender(AbstractCategoryRender categoryRender)
Sets the render for category item and sends an AxisChangeEvent to all registered listeners.

Parameters:
categoryRender - AbstractCategoryRender

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
Overrides:
calculateAxisSpace in class AbstractAxis
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.

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
Overrides:
draw in class AbstractAxis
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.

drawTickLabel

protected 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.

Overrides:
drawTickLabel in class CategoryAxis
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.

getFormatedTickLabels

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

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

clone

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

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

equals

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

Overrides:
equals in class CategoryAxis
Parameters:
obj - The object (null permitted).
Returns:
A boolean.

hashCode

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

Overrides:
hashCode in class CategoryAxis
Returns:
A hash code.