|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ijchart.xychart.axis.AbstractAxis
com.ijchart.xychart.axis.category.CategoryAxis
public class CategoryAxis
Title: IJChart
Description: a chart library for the Java(tm) platform.
An axis that displays categories (X-Axis).Copyright: Copyright (c) 2013
Company:
Field Summary | |
---|---|
protected double |
acategoryWidth
The width of a category. |
protected java.util.Hashtable |
categoryLabelPosition
The position of categorys. |
static double |
DEFAULT_CATEGORY_MARGIN
The default margin between categories (a percentage of the overall axis length). |
static HorizontalAlignment |
DEFAULT_HORIZONTAL_ALIGNMENT
The default horizontal alignment. |
static int |
DEFAULT_MAX_CATEGORY_LABEL_LINE
The default maximum number of lines for labels (default is all). |
Constructor Summary | |
---|---|
CategoryAxis(IMatrixDataset dataset)
Constructs an axis using a dataset. |
|
CategoryAxis(java.lang.String label,
IMatrixDataset dataset)
Constructs an axis using label and a dataset. |
Method Summary | |
---|---|
void |
addCategoryMarker(Layer layer,
CategoryMarker marker)
Calculate the position of category (colKey). |
void |
clearCategoryMarkers(Layer layer)
Clears all the category markers for the plot and sends an AxisChangeEvent to all registered listeners. |
java.lang.Object |
clone()
Creates a clone of the axis. |
protected IChartShape |
createChartShape(java.awt.geom.Rectangle2D tickLabelDrawRect,
java.lang.String tickLabel,
int rowKeyIndex)
Create a RectangleTextChartShape object. |
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 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 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 an arbitrary object. |
HorizontalAlignment |
getCategoryLabelHorizontalAlignment()
Returns the category label horizontal alignment. |
double |
getCategoryMargin()
Returns the category margin. |
java.util.Collection |
getCategoryMarkers(Layer layer)
Returns a collection of category markers for specified layer. |
protected java.lang.String[] |
getFormatedTickLabels(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D maxAxisArea,
RectangleEdge edge)
Returns the formated tick labels. |
protected double |
getLabelMaxDrawWidth(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
RectangleEdge edge)
Calculation the width of painting coordinate axis labels required by the maximum width and not more than maximumCategoryLabelWidthRatio determined by the parameters of the entire region of the chart width or height. |
int |
getMaximumCategoryLabelLines()
Returns the maximum number of lines to use for each category label. |
int |
hashCode()
Returns a hash code for this object. |
void |
markerChanged(MarkerChangeEvent event)
Receives notification of an marker change event. |
boolean |
removeCategoryMarker(Layer layer,
CategoryMarker marker)
Removes a marker for a specific layer and sends an AxisChangeEvent to all registered listeners. |
void |
setCategoryLabelHorizontalAlignment(HorizontalAlignment align)
Sets the category label horizontal alignment and sends an AxisChangeEvent to all registered listeners. |
void |
setCategoryMargin(double margin)
Sets the category margin and sends an AxisChangeEvent to
all registered listeners. |
void |
setMaximumCategoryLabelLines(int lines)
Sets the maximum number of lines to use for each category label 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 |
---|
public static final double DEFAULT_CATEGORY_MARGIN
public static final HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT
public static final int DEFAULT_MAX_CATEGORY_LABEL_LINE
protected java.util.Hashtable categoryLabelPosition
protected double acategoryWidth
Constructor Detail |
---|
public CategoryAxis(IMatrixDataset dataset)
dataset
- IMatrixDataset
The two dimension matrix dataset (null not permitted).public CategoryAxis(java.lang.String label, IMatrixDataset dataset)
label
-
The axis label (null permitted).dataset
- IMatrixDataset
The two dimension matrix dataset (null not permitted).Method Detail |
---|
public double getCategoryMargin()
public void setCategoryMargin(double margin)
AxisChangeEvent
to
all registered listeners. The overall category margin is distributed over
N-1 gaps, where N is the number of categories on the axis.
margin
-
The margin as a percentage of the axis length (for example, 0.05 is five percent).public int getMaximumCategoryLabelLines()
public void setMaximumCategoryLabelLines(int lines)
AxisChangeEvent
to all registered listeners.
lines
-
The maximum number of lines.public HorizontalAlignment getCategoryLabelHorizontalAlignment()
public void setCategoryLabelHorizontalAlignment(HorizontalAlignment align)
AxisChangeEvent
to all registered listeners.
align
- HorizontalAlignment
The category label horizontal alignment (null not permitted).protected double drawTickMark(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D axisArea, RectangleEdge edge, AxisShapeCollection shapeCollection, double cursor)
drawTickMark
in class AbstractAxis
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.
protected double drawTickLabel(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D axisArea, RectangleEdge edge, AxisShapeCollection shapeCollection, double cursor)
drawTickLabel
in class AbstractAxis
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.
public double categoryToJava2D(java.lang.Object category, TextAnchor anchor)
category
- Object
The category.anchor
- CategoryAnchor
The position of a text (null permitted).
protected IChartShape createChartShape(java.awt.geom.Rectangle2D tickLabelDrawRect, java.lang.String tickLabel, int rowKeyIndex)
tickLabelDrawRect
- Rectangle2D
The tick label bound.tickLabel
- String
The tick label.rowKeyIndex
-
The index of rowKey in dataset.
IChartShape
.protected double getLabelMaxDrawWidth(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, RectangleEdge edge)
g2
- Graphics2D
The graphics device (null not permitted).plotArea
- Rectangle2D
The area within which the plot should be drawn.edge
- RectangleEdge
The axis position.
protected java.lang.String[] getFormatedTickLabels(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D maxAxisArea, RectangleEdge edge)
getFormatedTickLabels
in class AbstractAxis
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).
public void addCategoryMarker(Layer layer, CategoryMarker marker)
Typically a marker will be drawn by the render as a line perpendicular to a category axis, however this is entirely up to the render.
layer
- Layer
The layer (foreground or background) (null not permitted).marker
- CategoryMarker
The marker (null not permitted).public java.util.Collection getCategoryMarkers(Layer layer)
layer
-
The layer (null not permitted).
public boolean removeCategoryMarker(Layer layer, CategoryMarker marker)
AxisChangeEvent
to all registered listeners.
layer
- Layer
The layer (foreground or background) (null not permitted).marker
- CategoryMarker
The marker (null not permitted).
public void clearCategoryMarkers(Layer layer)
AxisChangeEvent
to all registered listeners.
layer
- Layer
The layer (foreground or background) (null not permitted).public void drawGridLine(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, RectangleEdge axisEdge, RenderShapeCollection shapeCollection, java.awt.Stroke stroke, java.awt.Paint paint)
drawGridLine
in class AbstractAxis
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).public void markerChanged(MarkerChangeEvent event)
markerChanged
in interface IMarkerChangeListener
event
-
The marker change event.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class AbstractAxis
java.lang.CloneNotSupportedException
- if some component of the axis does
not support cloning.public boolean equals(java.lang.Object obj)
equals
in class AbstractAxis
obj
-
The object (null permitted).
public int hashCode()
hashCode
in class AbstractAxis
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |